
obj/user/testkbd.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 4d 02 00 00       	call   80027e <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <umain>:

#include <inc/lib.h>

void
umain(int argc, char **argv)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	53                   	push   %ebx
  80003b:	83 ec 04             	sub    $0x4,%esp
  80003e:	bb 0a 00 00 00       	mov    $0xa,%ebx
	int i, r;

	// Spin for a bit to let the console quiet
	for (i = 0; i < 10; ++i)
		sys_yield();
  800043:	e8 7b 0e 00 00       	call   800ec3 <sys_yield>
	for (i = 0; i < 10; ++i)
  800048:	83 eb 01             	sub    $0x1,%ebx
  80004b:	75 f6                	jne    800043 <umain+0x10>

	close(0);
  80004d:	83 ec 0c             	sub    $0xc,%esp
  800050:	6a 00                	push   $0x0
  800052:	e8 5e 12 00 00       	call   8012b5 <close>
	if ((r = opencons()) < 0)
  800057:	e8 cc 01 00 00       	call   800228 <opencons>
  80005c:	83 c4 10             	add    $0x10,%esp
  80005f:	85 c0                	test   %eax,%eax
  800061:	78 14                	js     800077 <umain+0x44>
		panic("opencons: %e", r);
	if (r != 0)
  800063:	74 24                	je     800089 <umain+0x56>
		panic("first opencons used fd %d", r);
  800065:	50                   	push   %eax
  800066:	68 bc 21 80 00       	push   $0x8021bc
  80006b:	6a 11                	push   $0x11
  80006d:	68 ad 21 80 00       	push   $0x8021ad
  800072:	e8 79 02 00 00       	call   8002f0 <_panic>
		panic("opencons: %e", r);
  800077:	50                   	push   %eax
  800078:	68 a0 21 80 00       	push   $0x8021a0
  80007d:	6a 0f                	push   $0xf
  80007f:	68 ad 21 80 00       	push   $0x8021ad
  800084:	e8 67 02 00 00       	call   8002f0 <_panic>
	if ((r = dup(0, 1)) < 0)
  800089:	83 ec 08             	sub    $0x8,%esp
  80008c:	6a 01                	push   $0x1
  80008e:	6a 00                	push   $0x0
  800090:	e8 7a 12 00 00       	call   80130f <dup>
  800095:	83 c4 10             	add    $0x10,%esp
  800098:	85 c0                	test   %eax,%eax
  80009a:	79 25                	jns    8000c1 <umain+0x8e>
		panic("dup: %e", r);
  80009c:	50                   	push   %eax
  80009d:	68 d6 21 80 00       	push   $0x8021d6
  8000a2:	6a 13                	push   $0x13
  8000a4:	68 ad 21 80 00       	push   $0x8021ad
  8000a9:	e8 42 02 00 00       	call   8002f0 <_panic>
	for(;;){
		char *buf;

		buf = readline("Type a line: ");
		if (buf != NULL)
			fprintf(1, "%s\n", buf);
  8000ae:	83 ec 04             	sub    $0x4,%esp
  8000b1:	50                   	push   %eax
  8000b2:	68 ec 21 80 00       	push   $0x8021ec
  8000b7:	6a 01                	push   $0x1
  8000b9:	e8 72 19 00 00       	call   801a30 <fprintf>
  8000be:	83 c4 10             	add    $0x10,%esp
		buf = readline("Type a line: ");
  8000c1:	83 ec 0c             	sub    $0xc,%esp
  8000c4:	68 de 21 80 00       	push   $0x8021de
  8000c9:	e8 9f 08 00 00       	call   80096d <readline>
		if (buf != NULL)
  8000ce:	83 c4 10             	add    $0x10,%esp
  8000d1:	85 c0                	test   %eax,%eax
  8000d3:	75 d9                	jne    8000ae <umain+0x7b>
		else
			fprintf(1, "(end of file received)\n");
  8000d5:	83 ec 08             	sub    $0x8,%esp
  8000d8:	68 f0 21 80 00       	push   $0x8021f0
  8000dd:	6a 01                	push   $0x1
  8000df:	e8 4c 19 00 00       	call   801a30 <fprintf>
  8000e4:	83 c4 10             	add    $0x10,%esp
  8000e7:	eb d8                	jmp    8000c1 <umain+0x8e>

008000e9 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  8000e9:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  8000ed:	b8 00 00 00 00       	mov    $0x0,%eax
  8000f2:	c3                   	ret    

008000f3 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  8000f3:	f3 0f 1e fb          	endbr32 
  8000f7:	55                   	push   %ebp
  8000f8:	89 e5                	mov    %esp,%ebp
  8000fa:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  8000fd:	68 08 22 80 00       	push   $0x802208
  800102:	ff 75 0c             	pushl  0xc(%ebp)
  800105:	e8 9a 09 00 00       	call   800aa4 <strcpy>
	return 0;
}
  80010a:	b8 00 00 00 00       	mov    $0x0,%eax
  80010f:	c9                   	leave  
  800110:	c3                   	ret    

00800111 <devcons_write>:
{
  800111:	f3 0f 1e fb          	endbr32 
  800115:	55                   	push   %ebp
  800116:	89 e5                	mov    %esp,%ebp
  800118:	57                   	push   %edi
  800119:	56                   	push   %esi
  80011a:	53                   	push   %ebx
  80011b:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  800121:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  800126:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  80012c:	3b 75 10             	cmp    0x10(%ebp),%esi
  80012f:	73 31                	jae    800162 <devcons_write+0x51>
		m = n - tot;
  800131:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800134:	29 f3                	sub    %esi,%ebx
  800136:	83 fb 7f             	cmp    $0x7f,%ebx
  800139:	b8 7f 00 00 00       	mov    $0x7f,%eax
  80013e:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  800141:	83 ec 04             	sub    $0x4,%esp
  800144:	53                   	push   %ebx
  800145:	89 f0                	mov    %esi,%eax
  800147:	03 45 0c             	add    0xc(%ebp),%eax
  80014a:	50                   	push   %eax
  80014b:	57                   	push   %edi
  80014c:	e8 09 0b 00 00       	call   800c5a <memmove>
		sys_cputs(buf, m);
  800151:	83 c4 08             	add    $0x8,%esp
  800154:	53                   	push   %ebx
  800155:	57                   	push   %edi
  800156:	e8 bb 0c 00 00       	call   800e16 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  80015b:	01 de                	add    %ebx,%esi
  80015d:	83 c4 10             	add    $0x10,%esp
  800160:	eb ca                	jmp    80012c <devcons_write+0x1b>
}
  800162:	89 f0                	mov    %esi,%eax
  800164:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800167:	5b                   	pop    %ebx
  800168:	5e                   	pop    %esi
  800169:	5f                   	pop    %edi
  80016a:	5d                   	pop    %ebp
  80016b:	c3                   	ret    

0080016c <devcons_read>:
{
  80016c:	f3 0f 1e fb          	endbr32 
  800170:	55                   	push   %ebp
  800171:	89 e5                	mov    %esp,%ebp
  800173:	83 ec 08             	sub    $0x8,%esp
  800176:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  80017b:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  80017f:	74 21                	je     8001a2 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  800181:	e8 b2 0c 00 00       	call   800e38 <sys_cgetc>
  800186:	85 c0                	test   %eax,%eax
  800188:	75 07                	jne    800191 <devcons_read+0x25>
		sys_yield();
  80018a:	e8 34 0d 00 00       	call   800ec3 <sys_yield>
  80018f:	eb f0                	jmp    800181 <devcons_read+0x15>
	if (c < 0)
  800191:	78 0f                	js     8001a2 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  800193:	83 f8 04             	cmp    $0x4,%eax
  800196:	74 0c                	je     8001a4 <devcons_read+0x38>
	*(char*)vbuf = c;
  800198:	8b 55 0c             	mov    0xc(%ebp),%edx
  80019b:	88 02                	mov    %al,(%edx)
	return 1;
  80019d:	b8 01 00 00 00       	mov    $0x1,%eax
}
  8001a2:	c9                   	leave  
  8001a3:	c3                   	ret    
		return 0;
  8001a4:	b8 00 00 00 00       	mov    $0x0,%eax
  8001a9:	eb f7                	jmp    8001a2 <devcons_read+0x36>

008001ab <cputchar>:
{
  8001ab:	f3 0f 1e fb          	endbr32 
  8001af:	55                   	push   %ebp
  8001b0:	89 e5                	mov    %esp,%ebp
  8001b2:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  8001b5:	8b 45 08             	mov    0x8(%ebp),%eax
  8001b8:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  8001bb:	6a 01                	push   $0x1
  8001bd:	8d 45 f7             	lea    -0x9(%ebp),%eax
  8001c0:	50                   	push   %eax
  8001c1:	e8 50 0c 00 00       	call   800e16 <sys_cputs>
}
  8001c6:	83 c4 10             	add    $0x10,%esp
  8001c9:	c9                   	leave  
  8001ca:	c3                   	ret    

008001cb <getchar>:
{
  8001cb:	f3 0f 1e fb          	endbr32 
  8001cf:	55                   	push   %ebp
  8001d0:	89 e5                	mov    %esp,%ebp
  8001d2:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  8001d5:	6a 01                	push   $0x1
  8001d7:	8d 45 f7             	lea    -0x9(%ebp),%eax
  8001da:	50                   	push   %eax
  8001db:	6a 00                	push   $0x0
  8001dd:	e8 1d 12 00 00       	call   8013ff <read>
	if (r < 0)
  8001e2:	83 c4 10             	add    $0x10,%esp
  8001e5:	85 c0                	test   %eax,%eax
  8001e7:	78 06                	js     8001ef <getchar+0x24>
	if (r < 1)
  8001e9:	74 06                	je     8001f1 <getchar+0x26>
	return c;
  8001eb:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  8001ef:	c9                   	leave  
  8001f0:	c3                   	ret    
		return -E_EOF;
  8001f1:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  8001f6:	eb f7                	jmp    8001ef <getchar+0x24>

008001f8 <iscons>:
{
  8001f8:	f3 0f 1e fb          	endbr32 
  8001fc:	55                   	push   %ebp
  8001fd:	89 e5                	mov    %esp,%ebp
  8001ff:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  800202:	8d 45 f4             	lea    -0xc(%ebp),%eax
  800205:	50                   	push   %eax
  800206:	ff 75 08             	pushl  0x8(%ebp)
  800209:	e8 6e 0f 00 00       	call   80117c <fd_lookup>
  80020e:	83 c4 10             	add    $0x10,%esp
  800211:	85 c0                	test   %eax,%eax
  800213:	78 11                	js     800226 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  800215:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800218:	8b 15 00 30 80 00    	mov    0x803000,%edx
  80021e:	39 10                	cmp    %edx,(%eax)
  800220:	0f 94 c0             	sete   %al
  800223:	0f b6 c0             	movzbl %al,%eax
}
  800226:	c9                   	leave  
  800227:	c3                   	ret    

00800228 <opencons>:
{
  800228:	f3 0f 1e fb          	endbr32 
  80022c:	55                   	push   %ebp
  80022d:	89 e5                	mov    %esp,%ebp
  80022f:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  800232:	8d 45 f4             	lea    -0xc(%ebp),%eax
  800235:	50                   	push   %eax
  800236:	e8 eb 0e 00 00       	call   801126 <fd_alloc>
  80023b:	83 c4 10             	add    $0x10,%esp
  80023e:	85 c0                	test   %eax,%eax
  800240:	78 3a                	js     80027c <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  800242:	83 ec 04             	sub    $0x4,%esp
  800245:	68 07 04 00 00       	push   $0x407
  80024a:	ff 75 f4             	pushl  -0xc(%ebp)
  80024d:	6a 00                	push   $0x0
  80024f:	e8 92 0c 00 00       	call   800ee6 <sys_page_alloc>
  800254:	83 c4 10             	add    $0x10,%esp
  800257:	85 c0                	test   %eax,%eax
  800259:	78 21                	js     80027c <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  80025b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80025e:	8b 15 00 30 80 00    	mov    0x803000,%edx
  800264:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  800266:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800269:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  800270:	83 ec 0c             	sub    $0xc,%esp
  800273:	50                   	push   %eax
  800274:	e8 7e 0e 00 00       	call   8010f7 <fd2num>
  800279:	83 c4 10             	add    $0x10,%esp
}
  80027c:	c9                   	leave  
  80027d:	c3                   	ret    

0080027e <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  80027e:	f3 0f 1e fb          	endbr32 
  800282:	55                   	push   %ebp
  800283:	89 e5                	mov    %esp,%ebp
  800285:	56                   	push   %esi
  800286:	53                   	push   %ebx
  800287:	8b 5d 08             	mov    0x8(%ebp),%ebx
  80028a:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  80028d:	c7 05 04 44 80 00 00 	movl   $0x0,0x804404
  800294:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  800297:	e8 04 0c 00 00       	call   800ea0 <sys_getenvid>
  80029c:	25 ff 03 00 00       	and    $0x3ff,%eax
  8002a1:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8002a4:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8002a9:	a3 04 44 80 00       	mov    %eax,0x804404

	// save the name of the program so that panic() can use it
	if (argc > 0)
  8002ae:	85 db                	test   %ebx,%ebx
  8002b0:	7e 07                	jle    8002b9 <libmain+0x3b>
		binaryname = argv[0];
  8002b2:	8b 06                	mov    (%esi),%eax
  8002b4:	a3 1c 30 80 00       	mov    %eax,0x80301c

	// call user main routine
	umain(argc, argv);
  8002b9:	83 ec 08             	sub    $0x8,%esp
  8002bc:	56                   	push   %esi
  8002bd:	53                   	push   %ebx
  8002be:	e8 70 fd ff ff       	call   800033 <umain>

	// exit gracefully
	exit();
  8002c3:	e8 0a 00 00 00       	call   8002d2 <exit>
}
  8002c8:	83 c4 10             	add    $0x10,%esp
  8002cb:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8002ce:	5b                   	pop    %ebx
  8002cf:	5e                   	pop    %esi
  8002d0:	5d                   	pop    %ebp
  8002d1:	c3                   	ret    

008002d2 <exit>:

#include <inc/lib.h>

void
exit(void)
{
  8002d2:	f3 0f 1e fb          	endbr32 
  8002d6:	55                   	push   %ebp
  8002d7:	89 e5                	mov    %esp,%ebp
  8002d9:	83 ec 08             	sub    $0x8,%esp
	close_all();
  8002dc:	e8 05 10 00 00       	call   8012e6 <close_all>
	sys_env_destroy(0);
  8002e1:	83 ec 0c             	sub    $0xc,%esp
  8002e4:	6a 00                	push   $0x0
  8002e6:	e8 70 0b 00 00       	call   800e5b <sys_env_destroy>
}
  8002eb:	83 c4 10             	add    $0x10,%esp
  8002ee:	c9                   	leave  
  8002ef:	c3                   	ret    

008002f0 <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  8002f0:	f3 0f 1e fb          	endbr32 
  8002f4:	55                   	push   %ebp
  8002f5:	89 e5                	mov    %esp,%ebp
  8002f7:	56                   	push   %esi
  8002f8:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  8002f9:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  8002fc:	8b 35 1c 30 80 00    	mov    0x80301c,%esi
  800302:	e8 99 0b 00 00       	call   800ea0 <sys_getenvid>
  800307:	83 ec 0c             	sub    $0xc,%esp
  80030a:	ff 75 0c             	pushl  0xc(%ebp)
  80030d:	ff 75 08             	pushl  0x8(%ebp)
  800310:	56                   	push   %esi
  800311:	50                   	push   %eax
  800312:	68 20 22 80 00       	push   $0x802220
  800317:	e8 bb 00 00 00       	call   8003d7 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  80031c:	83 c4 18             	add    $0x18,%esp
  80031f:	53                   	push   %ebx
  800320:	ff 75 10             	pushl  0x10(%ebp)
  800323:	e8 5a 00 00 00       	call   800382 <vcprintf>
	cprintf("\n");
  800328:	c7 04 24 06 22 80 00 	movl   $0x802206,(%esp)
  80032f:	e8 a3 00 00 00       	call   8003d7 <cprintf>
  800334:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  800337:	cc                   	int3   
  800338:	eb fd                	jmp    800337 <_panic+0x47>

0080033a <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  80033a:	f3 0f 1e fb          	endbr32 
  80033e:	55                   	push   %ebp
  80033f:	89 e5                	mov    %esp,%ebp
  800341:	53                   	push   %ebx
  800342:	83 ec 04             	sub    $0x4,%esp
  800345:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800348:	8b 13                	mov    (%ebx),%edx
  80034a:	8d 42 01             	lea    0x1(%edx),%eax
  80034d:	89 03                	mov    %eax,(%ebx)
  80034f:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800352:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  800356:	3d ff 00 00 00       	cmp    $0xff,%eax
  80035b:	74 09                	je     800366 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  80035d:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  800361:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800364:	c9                   	leave  
  800365:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  800366:	83 ec 08             	sub    $0x8,%esp
  800369:	68 ff 00 00 00       	push   $0xff
  80036e:	8d 43 08             	lea    0x8(%ebx),%eax
  800371:	50                   	push   %eax
  800372:	e8 9f 0a 00 00       	call   800e16 <sys_cputs>
		b->idx = 0;
  800377:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  80037d:	83 c4 10             	add    $0x10,%esp
  800380:	eb db                	jmp    80035d <putch+0x23>

00800382 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  800382:	f3 0f 1e fb          	endbr32 
  800386:	55                   	push   %ebp
  800387:	89 e5                	mov    %esp,%ebp
  800389:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  80038f:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  800396:	00 00 00 
	b.cnt = 0;
  800399:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  8003a0:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  8003a3:	ff 75 0c             	pushl  0xc(%ebp)
  8003a6:	ff 75 08             	pushl  0x8(%ebp)
  8003a9:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  8003af:	50                   	push   %eax
  8003b0:	68 3a 03 80 00       	push   $0x80033a
  8003b5:	e8 20 01 00 00       	call   8004da <vprintfmt>
	sys_cputs(b.buf, b.idx);
  8003ba:	83 c4 08             	add    $0x8,%esp
  8003bd:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  8003c3:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  8003c9:	50                   	push   %eax
  8003ca:	e8 47 0a 00 00       	call   800e16 <sys_cputs>

	return b.cnt;
}
  8003cf:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  8003d5:	c9                   	leave  
  8003d6:	c3                   	ret    

008003d7 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  8003d7:	f3 0f 1e fb          	endbr32 
  8003db:	55                   	push   %ebp
  8003dc:	89 e5                	mov    %esp,%ebp
  8003de:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  8003e1:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  8003e4:	50                   	push   %eax
  8003e5:	ff 75 08             	pushl  0x8(%ebp)
  8003e8:	e8 95 ff ff ff       	call   800382 <vcprintf>
	va_end(ap);

	return cnt;
}
  8003ed:	c9                   	leave  
  8003ee:	c3                   	ret    

008003ef <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  8003ef:	55                   	push   %ebp
  8003f0:	89 e5                	mov    %esp,%ebp
  8003f2:	57                   	push   %edi
  8003f3:	56                   	push   %esi
  8003f4:	53                   	push   %ebx
  8003f5:	83 ec 1c             	sub    $0x1c,%esp
  8003f8:	89 c7                	mov    %eax,%edi
  8003fa:	89 d6                	mov    %edx,%esi
  8003fc:	8b 45 08             	mov    0x8(%ebp),%eax
  8003ff:	8b 55 0c             	mov    0xc(%ebp),%edx
  800402:	89 d1                	mov    %edx,%ecx
  800404:	89 c2                	mov    %eax,%edx
  800406:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800409:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  80040c:	8b 45 10             	mov    0x10(%ebp),%eax
  80040f:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  800412:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800415:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  80041c:	39 c2                	cmp    %eax,%edx
  80041e:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  800421:	72 3e                	jb     800461 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  800423:	83 ec 0c             	sub    $0xc,%esp
  800426:	ff 75 18             	pushl  0x18(%ebp)
  800429:	83 eb 01             	sub    $0x1,%ebx
  80042c:	53                   	push   %ebx
  80042d:	50                   	push   %eax
  80042e:	83 ec 08             	sub    $0x8,%esp
  800431:	ff 75 e4             	pushl  -0x1c(%ebp)
  800434:	ff 75 e0             	pushl  -0x20(%ebp)
  800437:	ff 75 dc             	pushl  -0x24(%ebp)
  80043a:	ff 75 d8             	pushl  -0x28(%ebp)
  80043d:	e8 ee 1a 00 00       	call   801f30 <__udivdi3>
  800442:	83 c4 18             	add    $0x18,%esp
  800445:	52                   	push   %edx
  800446:	50                   	push   %eax
  800447:	89 f2                	mov    %esi,%edx
  800449:	89 f8                	mov    %edi,%eax
  80044b:	e8 9f ff ff ff       	call   8003ef <printnum>
  800450:	83 c4 20             	add    $0x20,%esp
  800453:	eb 13                	jmp    800468 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  800455:	83 ec 08             	sub    $0x8,%esp
  800458:	56                   	push   %esi
  800459:	ff 75 18             	pushl  0x18(%ebp)
  80045c:	ff d7                	call   *%edi
  80045e:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  800461:	83 eb 01             	sub    $0x1,%ebx
  800464:	85 db                	test   %ebx,%ebx
  800466:	7f ed                	jg     800455 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  800468:	83 ec 08             	sub    $0x8,%esp
  80046b:	56                   	push   %esi
  80046c:	83 ec 04             	sub    $0x4,%esp
  80046f:	ff 75 e4             	pushl  -0x1c(%ebp)
  800472:	ff 75 e0             	pushl  -0x20(%ebp)
  800475:	ff 75 dc             	pushl  -0x24(%ebp)
  800478:	ff 75 d8             	pushl  -0x28(%ebp)
  80047b:	e8 c0 1b 00 00       	call   802040 <__umoddi3>
  800480:	83 c4 14             	add    $0x14,%esp
  800483:	0f be 80 43 22 80 00 	movsbl 0x802243(%eax),%eax
  80048a:	50                   	push   %eax
  80048b:	ff d7                	call   *%edi
}
  80048d:	83 c4 10             	add    $0x10,%esp
  800490:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800493:	5b                   	pop    %ebx
  800494:	5e                   	pop    %esi
  800495:	5f                   	pop    %edi
  800496:	5d                   	pop    %ebp
  800497:	c3                   	ret    

00800498 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  800498:	f3 0f 1e fb          	endbr32 
  80049c:	55                   	push   %ebp
  80049d:	89 e5                	mov    %esp,%ebp
  80049f:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  8004a2:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  8004a6:	8b 10                	mov    (%eax),%edx
  8004a8:	3b 50 04             	cmp    0x4(%eax),%edx
  8004ab:	73 0a                	jae    8004b7 <sprintputch+0x1f>
		*b->buf++ = ch;
  8004ad:	8d 4a 01             	lea    0x1(%edx),%ecx
  8004b0:	89 08                	mov    %ecx,(%eax)
  8004b2:	8b 45 08             	mov    0x8(%ebp),%eax
  8004b5:	88 02                	mov    %al,(%edx)
}
  8004b7:	5d                   	pop    %ebp
  8004b8:	c3                   	ret    

008004b9 <printfmt>:
{
  8004b9:	f3 0f 1e fb          	endbr32 
  8004bd:	55                   	push   %ebp
  8004be:	89 e5                	mov    %esp,%ebp
  8004c0:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  8004c3:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  8004c6:	50                   	push   %eax
  8004c7:	ff 75 10             	pushl  0x10(%ebp)
  8004ca:	ff 75 0c             	pushl  0xc(%ebp)
  8004cd:	ff 75 08             	pushl  0x8(%ebp)
  8004d0:	e8 05 00 00 00       	call   8004da <vprintfmt>
}
  8004d5:	83 c4 10             	add    $0x10,%esp
  8004d8:	c9                   	leave  
  8004d9:	c3                   	ret    

008004da <vprintfmt>:
{
  8004da:	f3 0f 1e fb          	endbr32 
  8004de:	55                   	push   %ebp
  8004df:	89 e5                	mov    %esp,%ebp
  8004e1:	57                   	push   %edi
  8004e2:	56                   	push   %esi
  8004e3:	53                   	push   %ebx
  8004e4:	83 ec 3c             	sub    $0x3c,%esp
  8004e7:	8b 75 08             	mov    0x8(%ebp),%esi
  8004ea:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  8004ed:	8b 7d 10             	mov    0x10(%ebp),%edi
  8004f0:	e9 5d 03 00 00       	jmp    800852 <vprintfmt+0x378>
		padc = ' ';
  8004f5:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  8004f9:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  800500:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800507:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  80050e:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800513:	8d 47 01             	lea    0x1(%edi),%eax
  800516:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800519:	0f b6 17             	movzbl (%edi),%edx
  80051c:	8d 42 dd             	lea    -0x23(%edx),%eax
  80051f:	3c 55                	cmp    $0x55,%al
  800521:	0f 87 ae 03 00 00    	ja     8008d5 <vprintfmt+0x3fb>
  800527:	0f b6 c0             	movzbl %al,%eax
  80052a:	3e ff 24 85 80 23 80 	notrack jmp *0x802380(,%eax,4)
  800531:	00 
  800532:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  800535:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  800539:	eb d8                	jmp    800513 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80053b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  80053e:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  800542:	eb cf                	jmp    800513 <vprintfmt+0x39>
  800544:	0f b6 d2             	movzbl %dl,%edx
  800547:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  80054a:	b8 00 00 00 00       	mov    $0x0,%eax
  80054f:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  800552:	8d 04 80             	lea    (%eax,%eax,4),%eax
  800555:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  800559:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  80055c:	8d 4a d0             	lea    -0x30(%edx),%ecx
  80055f:	83 f9 09             	cmp    $0x9,%ecx
  800562:	77 55                	ja     8005b9 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  800564:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  800567:	eb e9                	jmp    800552 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  800569:	8b 45 14             	mov    0x14(%ebp),%eax
  80056c:	8b 00                	mov    (%eax),%eax
  80056e:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800571:	8b 45 14             	mov    0x14(%ebp),%eax
  800574:	8d 40 04             	lea    0x4(%eax),%eax
  800577:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  80057a:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  80057d:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800581:	79 90                	jns    800513 <vprintfmt+0x39>
				width = precision, precision = -1;
  800583:	8b 45 d8             	mov    -0x28(%ebp),%eax
  800586:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800589:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  800590:	eb 81                	jmp    800513 <vprintfmt+0x39>
  800592:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  800595:	85 c0                	test   %eax,%eax
  800597:	ba 00 00 00 00       	mov    $0x0,%edx
  80059c:	0f 49 d0             	cmovns %eax,%edx
  80059f:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8005a2:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8005a5:	e9 69 ff ff ff       	jmp    800513 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8005aa:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  8005ad:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  8005b4:	e9 5a ff ff ff       	jmp    800513 <vprintfmt+0x39>
  8005b9:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  8005bc:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8005bf:	eb bc                	jmp    80057d <vprintfmt+0xa3>
			lflag++;
  8005c1:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  8005c4:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8005c7:	e9 47 ff ff ff       	jmp    800513 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  8005cc:	8b 45 14             	mov    0x14(%ebp),%eax
  8005cf:	8d 78 04             	lea    0x4(%eax),%edi
  8005d2:	83 ec 08             	sub    $0x8,%esp
  8005d5:	53                   	push   %ebx
  8005d6:	ff 30                	pushl  (%eax)
  8005d8:	ff d6                	call   *%esi
			break;
  8005da:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  8005dd:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  8005e0:	e9 6a 02 00 00       	jmp    80084f <vprintfmt+0x375>
			err = va_arg(ap, int);
  8005e5:	8b 45 14             	mov    0x14(%ebp),%eax
  8005e8:	8d 78 04             	lea    0x4(%eax),%edi
  8005eb:	8b 00                	mov    (%eax),%eax
  8005ed:	99                   	cltd   
  8005ee:	31 d0                	xor    %edx,%eax
  8005f0:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  8005f2:	83 f8 0f             	cmp    $0xf,%eax
  8005f5:	7f 23                	jg     80061a <vprintfmt+0x140>
  8005f7:	8b 14 85 e0 24 80 00 	mov    0x8024e0(,%eax,4),%edx
  8005fe:	85 d2                	test   %edx,%edx
  800600:	74 18                	je     80061a <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  800602:	52                   	push   %edx
  800603:	68 21 26 80 00       	push   $0x802621
  800608:	53                   	push   %ebx
  800609:	56                   	push   %esi
  80060a:	e8 aa fe ff ff       	call   8004b9 <printfmt>
  80060f:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800612:	89 7d 14             	mov    %edi,0x14(%ebp)
  800615:	e9 35 02 00 00       	jmp    80084f <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  80061a:	50                   	push   %eax
  80061b:	68 5b 22 80 00       	push   $0x80225b
  800620:	53                   	push   %ebx
  800621:	56                   	push   %esi
  800622:	e8 92 fe ff ff       	call   8004b9 <printfmt>
  800627:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  80062a:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  80062d:	e9 1d 02 00 00       	jmp    80084f <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  800632:	8b 45 14             	mov    0x14(%ebp),%eax
  800635:	83 c0 04             	add    $0x4,%eax
  800638:	89 45 c8             	mov    %eax,-0x38(%ebp)
  80063b:	8b 45 14             	mov    0x14(%ebp),%eax
  80063e:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  800640:	85 d2                	test   %edx,%edx
  800642:	b8 54 22 80 00       	mov    $0x802254,%eax
  800647:	0f 45 c2             	cmovne %edx,%eax
  80064a:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  80064d:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800651:	7e 06                	jle    800659 <vprintfmt+0x17f>
  800653:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  800657:	75 0d                	jne    800666 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  800659:	8b 45 cc             	mov    -0x34(%ebp),%eax
  80065c:	89 c7                	mov    %eax,%edi
  80065e:	03 45 d4             	add    -0x2c(%ebp),%eax
  800661:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800664:	eb 55                	jmp    8006bb <vprintfmt+0x1e1>
  800666:	83 ec 08             	sub    $0x8,%esp
  800669:	ff 75 d8             	pushl  -0x28(%ebp)
  80066c:	ff 75 cc             	pushl  -0x34(%ebp)
  80066f:	e8 09 04 00 00       	call   800a7d <strnlen>
  800674:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  800677:	29 c2                	sub    %eax,%edx
  800679:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  80067c:	83 c4 10             	add    $0x10,%esp
  80067f:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  800681:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  800685:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  800688:	85 ff                	test   %edi,%edi
  80068a:	7e 11                	jle    80069d <vprintfmt+0x1c3>
					putch(padc, putdat);
  80068c:	83 ec 08             	sub    $0x8,%esp
  80068f:	53                   	push   %ebx
  800690:	ff 75 d4             	pushl  -0x2c(%ebp)
  800693:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  800695:	83 ef 01             	sub    $0x1,%edi
  800698:	83 c4 10             	add    $0x10,%esp
  80069b:	eb eb                	jmp    800688 <vprintfmt+0x1ae>
  80069d:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  8006a0:	85 d2                	test   %edx,%edx
  8006a2:	b8 00 00 00 00       	mov    $0x0,%eax
  8006a7:	0f 49 c2             	cmovns %edx,%eax
  8006aa:	29 c2                	sub    %eax,%edx
  8006ac:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  8006af:	eb a8                	jmp    800659 <vprintfmt+0x17f>
					putch(ch, putdat);
  8006b1:	83 ec 08             	sub    $0x8,%esp
  8006b4:	53                   	push   %ebx
  8006b5:	52                   	push   %edx
  8006b6:	ff d6                	call   *%esi
  8006b8:	83 c4 10             	add    $0x10,%esp
  8006bb:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  8006be:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  8006c0:	83 c7 01             	add    $0x1,%edi
  8006c3:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8006c7:	0f be d0             	movsbl %al,%edx
  8006ca:	85 d2                	test   %edx,%edx
  8006cc:	74 4b                	je     800719 <vprintfmt+0x23f>
  8006ce:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  8006d2:	78 06                	js     8006da <vprintfmt+0x200>
  8006d4:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  8006d8:	78 1e                	js     8006f8 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  8006da:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  8006de:	74 d1                	je     8006b1 <vprintfmt+0x1d7>
  8006e0:	0f be c0             	movsbl %al,%eax
  8006e3:	83 e8 20             	sub    $0x20,%eax
  8006e6:	83 f8 5e             	cmp    $0x5e,%eax
  8006e9:	76 c6                	jbe    8006b1 <vprintfmt+0x1d7>
					putch('?', putdat);
  8006eb:	83 ec 08             	sub    $0x8,%esp
  8006ee:	53                   	push   %ebx
  8006ef:	6a 3f                	push   $0x3f
  8006f1:	ff d6                	call   *%esi
  8006f3:	83 c4 10             	add    $0x10,%esp
  8006f6:	eb c3                	jmp    8006bb <vprintfmt+0x1e1>
  8006f8:	89 cf                	mov    %ecx,%edi
  8006fa:	eb 0e                	jmp    80070a <vprintfmt+0x230>
				putch(' ', putdat);
  8006fc:	83 ec 08             	sub    $0x8,%esp
  8006ff:	53                   	push   %ebx
  800700:	6a 20                	push   $0x20
  800702:	ff d6                	call   *%esi
			for (; width > 0; width--)
  800704:	83 ef 01             	sub    $0x1,%edi
  800707:	83 c4 10             	add    $0x10,%esp
  80070a:	85 ff                	test   %edi,%edi
  80070c:	7f ee                	jg     8006fc <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  80070e:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800711:	89 45 14             	mov    %eax,0x14(%ebp)
  800714:	e9 36 01 00 00       	jmp    80084f <vprintfmt+0x375>
  800719:	89 cf                	mov    %ecx,%edi
  80071b:	eb ed                	jmp    80070a <vprintfmt+0x230>
	if (lflag >= 2)
  80071d:	83 f9 01             	cmp    $0x1,%ecx
  800720:	7f 1f                	jg     800741 <vprintfmt+0x267>
	else if (lflag)
  800722:	85 c9                	test   %ecx,%ecx
  800724:	74 67                	je     80078d <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800726:	8b 45 14             	mov    0x14(%ebp),%eax
  800729:	8b 00                	mov    (%eax),%eax
  80072b:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80072e:	89 c1                	mov    %eax,%ecx
  800730:	c1 f9 1f             	sar    $0x1f,%ecx
  800733:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800736:	8b 45 14             	mov    0x14(%ebp),%eax
  800739:	8d 40 04             	lea    0x4(%eax),%eax
  80073c:	89 45 14             	mov    %eax,0x14(%ebp)
  80073f:	eb 17                	jmp    800758 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800741:	8b 45 14             	mov    0x14(%ebp),%eax
  800744:	8b 50 04             	mov    0x4(%eax),%edx
  800747:	8b 00                	mov    (%eax),%eax
  800749:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80074c:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80074f:	8b 45 14             	mov    0x14(%ebp),%eax
  800752:	8d 40 08             	lea    0x8(%eax),%eax
  800755:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  800758:	8b 55 d8             	mov    -0x28(%ebp),%edx
  80075b:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  80075e:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  800763:	85 c9                	test   %ecx,%ecx
  800765:	0f 89 ca 00 00 00    	jns    800835 <vprintfmt+0x35b>
				putch('-', putdat);
  80076b:	83 ec 08             	sub    $0x8,%esp
  80076e:	53                   	push   %ebx
  80076f:	6a 2d                	push   $0x2d
  800771:	ff d6                	call   *%esi
				num = -(long long) num;
  800773:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800776:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  800779:	f7 da                	neg    %edx
  80077b:	83 d1 00             	adc    $0x0,%ecx
  80077e:	f7 d9                	neg    %ecx
  800780:	83 c4 10             	add    $0x10,%esp
			base = 10;
  800783:	b8 0a 00 00 00       	mov    $0xa,%eax
  800788:	e9 a8 00 00 00       	jmp    800835 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  80078d:	8b 45 14             	mov    0x14(%ebp),%eax
  800790:	8b 00                	mov    (%eax),%eax
  800792:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800795:	99                   	cltd   
  800796:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800799:	8b 45 14             	mov    0x14(%ebp),%eax
  80079c:	8d 40 04             	lea    0x4(%eax),%eax
  80079f:	89 45 14             	mov    %eax,0x14(%ebp)
  8007a2:	eb b4                	jmp    800758 <vprintfmt+0x27e>
	if (lflag >= 2)
  8007a4:	83 f9 01             	cmp    $0x1,%ecx
  8007a7:	7f 1b                	jg     8007c4 <vprintfmt+0x2ea>
	else if (lflag)
  8007a9:	85 c9                	test   %ecx,%ecx
  8007ab:	74 2c                	je     8007d9 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  8007ad:	8b 45 14             	mov    0x14(%ebp),%eax
  8007b0:	8b 10                	mov    (%eax),%edx
  8007b2:	b9 00 00 00 00       	mov    $0x0,%ecx
  8007b7:	8d 40 04             	lea    0x4(%eax),%eax
  8007ba:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8007bd:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  8007c2:	eb 71                	jmp    800835 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8007c4:	8b 45 14             	mov    0x14(%ebp),%eax
  8007c7:	8b 10                	mov    (%eax),%edx
  8007c9:	8b 48 04             	mov    0x4(%eax),%ecx
  8007cc:	8d 40 08             	lea    0x8(%eax),%eax
  8007cf:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8007d2:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  8007d7:	eb 5c                	jmp    800835 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8007d9:	8b 45 14             	mov    0x14(%ebp),%eax
  8007dc:	8b 10                	mov    (%eax),%edx
  8007de:	b9 00 00 00 00       	mov    $0x0,%ecx
  8007e3:	8d 40 04             	lea    0x4(%eax),%eax
  8007e6:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8007e9:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  8007ee:	eb 45                	jmp    800835 <vprintfmt+0x35b>
			putch('X', putdat);
  8007f0:	83 ec 08             	sub    $0x8,%esp
  8007f3:	53                   	push   %ebx
  8007f4:	6a 58                	push   $0x58
  8007f6:	ff d6                	call   *%esi
			putch('X', putdat);
  8007f8:	83 c4 08             	add    $0x8,%esp
  8007fb:	53                   	push   %ebx
  8007fc:	6a 58                	push   $0x58
  8007fe:	ff d6                	call   *%esi
			putch('X', putdat);
  800800:	83 c4 08             	add    $0x8,%esp
  800803:	53                   	push   %ebx
  800804:	6a 58                	push   $0x58
  800806:	ff d6                	call   *%esi
			break;
  800808:	83 c4 10             	add    $0x10,%esp
  80080b:	eb 42                	jmp    80084f <vprintfmt+0x375>
			putch('0', putdat);
  80080d:	83 ec 08             	sub    $0x8,%esp
  800810:	53                   	push   %ebx
  800811:	6a 30                	push   $0x30
  800813:	ff d6                	call   *%esi
			putch('x', putdat);
  800815:	83 c4 08             	add    $0x8,%esp
  800818:	53                   	push   %ebx
  800819:	6a 78                	push   $0x78
  80081b:	ff d6                	call   *%esi
			num = (unsigned long long)
  80081d:	8b 45 14             	mov    0x14(%ebp),%eax
  800820:	8b 10                	mov    (%eax),%edx
  800822:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800827:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  80082a:	8d 40 04             	lea    0x4(%eax),%eax
  80082d:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800830:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800835:	83 ec 0c             	sub    $0xc,%esp
  800838:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  80083c:	57                   	push   %edi
  80083d:	ff 75 d4             	pushl  -0x2c(%ebp)
  800840:	50                   	push   %eax
  800841:	51                   	push   %ecx
  800842:	52                   	push   %edx
  800843:	89 da                	mov    %ebx,%edx
  800845:	89 f0                	mov    %esi,%eax
  800847:	e8 a3 fb ff ff       	call   8003ef <printnum>
			break;
  80084c:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  80084f:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  800852:	83 c7 01             	add    $0x1,%edi
  800855:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800859:	83 f8 25             	cmp    $0x25,%eax
  80085c:	0f 84 93 fc ff ff    	je     8004f5 <vprintfmt+0x1b>
			if (ch == '\0')
  800862:	85 c0                	test   %eax,%eax
  800864:	0f 84 8b 00 00 00    	je     8008f5 <vprintfmt+0x41b>
			putch(ch, putdat);
  80086a:	83 ec 08             	sub    $0x8,%esp
  80086d:	53                   	push   %ebx
  80086e:	50                   	push   %eax
  80086f:	ff d6                	call   *%esi
  800871:	83 c4 10             	add    $0x10,%esp
  800874:	eb dc                	jmp    800852 <vprintfmt+0x378>
	if (lflag >= 2)
  800876:	83 f9 01             	cmp    $0x1,%ecx
  800879:	7f 1b                	jg     800896 <vprintfmt+0x3bc>
	else if (lflag)
  80087b:	85 c9                	test   %ecx,%ecx
  80087d:	74 2c                	je     8008ab <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  80087f:	8b 45 14             	mov    0x14(%ebp),%eax
  800882:	8b 10                	mov    (%eax),%edx
  800884:	b9 00 00 00 00       	mov    $0x0,%ecx
  800889:	8d 40 04             	lea    0x4(%eax),%eax
  80088c:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80088f:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  800894:	eb 9f                	jmp    800835 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800896:	8b 45 14             	mov    0x14(%ebp),%eax
  800899:	8b 10                	mov    (%eax),%edx
  80089b:	8b 48 04             	mov    0x4(%eax),%ecx
  80089e:	8d 40 08             	lea    0x8(%eax),%eax
  8008a1:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8008a4:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  8008a9:	eb 8a                	jmp    800835 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8008ab:	8b 45 14             	mov    0x14(%ebp),%eax
  8008ae:	8b 10                	mov    (%eax),%edx
  8008b0:	b9 00 00 00 00       	mov    $0x0,%ecx
  8008b5:	8d 40 04             	lea    0x4(%eax),%eax
  8008b8:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8008bb:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  8008c0:	e9 70 ff ff ff       	jmp    800835 <vprintfmt+0x35b>
			putch(ch, putdat);
  8008c5:	83 ec 08             	sub    $0x8,%esp
  8008c8:	53                   	push   %ebx
  8008c9:	6a 25                	push   $0x25
  8008cb:	ff d6                	call   *%esi
			break;
  8008cd:	83 c4 10             	add    $0x10,%esp
  8008d0:	e9 7a ff ff ff       	jmp    80084f <vprintfmt+0x375>
			putch('%', putdat);
  8008d5:	83 ec 08             	sub    $0x8,%esp
  8008d8:	53                   	push   %ebx
  8008d9:	6a 25                	push   $0x25
  8008db:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  8008dd:	83 c4 10             	add    $0x10,%esp
  8008e0:	89 f8                	mov    %edi,%eax
  8008e2:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  8008e6:	74 05                	je     8008ed <vprintfmt+0x413>
  8008e8:	83 e8 01             	sub    $0x1,%eax
  8008eb:	eb f5                	jmp    8008e2 <vprintfmt+0x408>
  8008ed:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8008f0:	e9 5a ff ff ff       	jmp    80084f <vprintfmt+0x375>
}
  8008f5:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8008f8:	5b                   	pop    %ebx
  8008f9:	5e                   	pop    %esi
  8008fa:	5f                   	pop    %edi
  8008fb:	5d                   	pop    %ebp
  8008fc:	c3                   	ret    

008008fd <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  8008fd:	f3 0f 1e fb          	endbr32 
  800901:	55                   	push   %ebp
  800902:	89 e5                	mov    %esp,%ebp
  800904:	83 ec 18             	sub    $0x18,%esp
  800907:	8b 45 08             	mov    0x8(%ebp),%eax
  80090a:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  80090d:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800910:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800914:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800917:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  80091e:	85 c0                	test   %eax,%eax
  800920:	74 26                	je     800948 <vsnprintf+0x4b>
  800922:	85 d2                	test   %edx,%edx
  800924:	7e 22                	jle    800948 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800926:	ff 75 14             	pushl  0x14(%ebp)
  800929:	ff 75 10             	pushl  0x10(%ebp)
  80092c:	8d 45 ec             	lea    -0x14(%ebp),%eax
  80092f:	50                   	push   %eax
  800930:	68 98 04 80 00       	push   $0x800498
  800935:	e8 a0 fb ff ff       	call   8004da <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  80093a:	8b 45 ec             	mov    -0x14(%ebp),%eax
  80093d:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  800940:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800943:	83 c4 10             	add    $0x10,%esp
}
  800946:	c9                   	leave  
  800947:	c3                   	ret    
		return -E_INVAL;
  800948:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80094d:	eb f7                	jmp    800946 <vsnprintf+0x49>

0080094f <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  80094f:	f3 0f 1e fb          	endbr32 
  800953:	55                   	push   %ebp
  800954:	89 e5                	mov    %esp,%ebp
  800956:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  800959:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  80095c:	50                   	push   %eax
  80095d:	ff 75 10             	pushl  0x10(%ebp)
  800960:	ff 75 0c             	pushl  0xc(%ebp)
  800963:	ff 75 08             	pushl  0x8(%ebp)
  800966:	e8 92 ff ff ff       	call   8008fd <vsnprintf>
	va_end(ap);

	return rc;
}
  80096b:	c9                   	leave  
  80096c:	c3                   	ret    

0080096d <readline>:
#define BUFLEN 1024
static char buf[BUFLEN];

char *
readline(const char *prompt)
{
  80096d:	f3 0f 1e fb          	endbr32 
  800971:	55                   	push   %ebp
  800972:	89 e5                	mov    %esp,%ebp
  800974:	57                   	push   %edi
  800975:	56                   	push   %esi
  800976:	53                   	push   %ebx
  800977:	83 ec 0c             	sub    $0xc,%esp
  80097a:	8b 45 08             	mov    0x8(%ebp),%eax

#if JOS_KERNEL
	if (prompt != NULL)
		cprintf("%s", prompt);
#else
	if (prompt != NULL)
  80097d:	85 c0                	test   %eax,%eax
  80097f:	74 13                	je     800994 <readline+0x27>
		fprintf(1, "%s", prompt);
  800981:	83 ec 04             	sub    $0x4,%esp
  800984:	50                   	push   %eax
  800985:	68 21 26 80 00       	push   $0x802621
  80098a:	6a 01                	push   $0x1
  80098c:	e8 9f 10 00 00       	call   801a30 <fprintf>
  800991:	83 c4 10             	add    $0x10,%esp
#endif

	i = 0;
	echoing = iscons(0);
  800994:	83 ec 0c             	sub    $0xc,%esp
  800997:	6a 00                	push   $0x0
  800999:	e8 5a f8 ff ff       	call   8001f8 <iscons>
  80099e:	89 c7                	mov    %eax,%edi
  8009a0:	83 c4 10             	add    $0x10,%esp
	i = 0;
  8009a3:	be 00 00 00 00       	mov    $0x0,%esi
  8009a8:	eb 57                	jmp    800a01 <readline+0x94>
	while (1) {
		c = getchar();
		if (c < 0) {
			if (c != -E_EOF)
				cprintf("read error: %e\n", c);
			return NULL;
  8009aa:	b8 00 00 00 00       	mov    $0x0,%eax
			if (c != -E_EOF)
  8009af:	83 fb f8             	cmp    $0xfffffff8,%ebx
  8009b2:	75 08                	jne    8009bc <readline+0x4f>
				cputchar('\n');
			buf[i] = 0;
			return buf;
		}
	}
}
  8009b4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8009b7:	5b                   	pop    %ebx
  8009b8:	5e                   	pop    %esi
  8009b9:	5f                   	pop    %edi
  8009ba:	5d                   	pop    %ebp
  8009bb:	c3                   	ret    
				cprintf("read error: %e\n", c);
  8009bc:	83 ec 08             	sub    $0x8,%esp
  8009bf:	53                   	push   %ebx
  8009c0:	68 3f 25 80 00       	push   $0x80253f
  8009c5:	e8 0d fa ff ff       	call   8003d7 <cprintf>
  8009ca:	83 c4 10             	add    $0x10,%esp
			return NULL;
  8009cd:	b8 00 00 00 00       	mov    $0x0,%eax
  8009d2:	eb e0                	jmp    8009b4 <readline+0x47>
			if (echoing)
  8009d4:	85 ff                	test   %edi,%edi
  8009d6:	75 05                	jne    8009dd <readline+0x70>
			i--;
  8009d8:	83 ee 01             	sub    $0x1,%esi
  8009db:	eb 24                	jmp    800a01 <readline+0x94>
				cputchar('\b');
  8009dd:	83 ec 0c             	sub    $0xc,%esp
  8009e0:	6a 08                	push   $0x8
  8009e2:	e8 c4 f7 ff ff       	call   8001ab <cputchar>
  8009e7:	83 c4 10             	add    $0x10,%esp
  8009ea:	eb ec                	jmp    8009d8 <readline+0x6b>
				cputchar(c);
  8009ec:	83 ec 0c             	sub    $0xc,%esp
  8009ef:	53                   	push   %ebx
  8009f0:	e8 b6 f7 ff ff       	call   8001ab <cputchar>
  8009f5:	83 c4 10             	add    $0x10,%esp
			buf[i++] = c;
  8009f8:	88 9e 00 40 80 00    	mov    %bl,0x804000(%esi)
  8009fe:	8d 76 01             	lea    0x1(%esi),%esi
		c = getchar();
  800a01:	e8 c5 f7 ff ff       	call   8001cb <getchar>
  800a06:	89 c3                	mov    %eax,%ebx
		if (c < 0) {
  800a08:	85 c0                	test   %eax,%eax
  800a0a:	78 9e                	js     8009aa <readline+0x3d>
		} else if ((c == '\b' || c == '\x7f') && i > 0) {
  800a0c:	83 f8 08             	cmp    $0x8,%eax
  800a0f:	0f 94 c2             	sete   %dl
  800a12:	83 f8 7f             	cmp    $0x7f,%eax
  800a15:	0f 94 c0             	sete   %al
  800a18:	08 c2                	or     %al,%dl
  800a1a:	74 04                	je     800a20 <readline+0xb3>
  800a1c:	85 f6                	test   %esi,%esi
  800a1e:	7f b4                	jg     8009d4 <readline+0x67>
		} else if (c >= ' ' && i < BUFLEN-1) {
  800a20:	83 fb 1f             	cmp    $0x1f,%ebx
  800a23:	7e 0e                	jle    800a33 <readline+0xc6>
  800a25:	81 fe fe 03 00 00    	cmp    $0x3fe,%esi
  800a2b:	7f 06                	jg     800a33 <readline+0xc6>
			if (echoing)
  800a2d:	85 ff                	test   %edi,%edi
  800a2f:	74 c7                	je     8009f8 <readline+0x8b>
  800a31:	eb b9                	jmp    8009ec <readline+0x7f>
		} else if (c == '\n' || c == '\r') {
  800a33:	83 fb 0a             	cmp    $0xa,%ebx
  800a36:	74 05                	je     800a3d <readline+0xd0>
  800a38:	83 fb 0d             	cmp    $0xd,%ebx
  800a3b:	75 c4                	jne    800a01 <readline+0x94>
			if (echoing)
  800a3d:	85 ff                	test   %edi,%edi
  800a3f:	75 11                	jne    800a52 <readline+0xe5>
			buf[i] = 0;
  800a41:	c6 86 00 40 80 00 00 	movb   $0x0,0x804000(%esi)
			return buf;
  800a48:	b8 00 40 80 00       	mov    $0x804000,%eax
  800a4d:	e9 62 ff ff ff       	jmp    8009b4 <readline+0x47>
				cputchar('\n');
  800a52:	83 ec 0c             	sub    $0xc,%esp
  800a55:	6a 0a                	push   $0xa
  800a57:	e8 4f f7 ff ff       	call   8001ab <cputchar>
  800a5c:	83 c4 10             	add    $0x10,%esp
  800a5f:	eb e0                	jmp    800a41 <readline+0xd4>

00800a61 <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  800a61:	f3 0f 1e fb          	endbr32 
  800a65:	55                   	push   %ebp
  800a66:	89 e5                	mov    %esp,%ebp
  800a68:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  800a6b:	b8 00 00 00 00       	mov    $0x0,%eax
  800a70:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  800a74:	74 05                	je     800a7b <strlen+0x1a>
		n++;
  800a76:	83 c0 01             	add    $0x1,%eax
  800a79:	eb f5                	jmp    800a70 <strlen+0xf>
	return n;
}
  800a7b:	5d                   	pop    %ebp
  800a7c:	c3                   	ret    

00800a7d <strnlen>:

int
strnlen(const char *s, size_t size)
{
  800a7d:	f3 0f 1e fb          	endbr32 
  800a81:	55                   	push   %ebp
  800a82:	89 e5                	mov    %esp,%ebp
  800a84:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800a87:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  800a8a:	b8 00 00 00 00       	mov    $0x0,%eax
  800a8f:	39 d0                	cmp    %edx,%eax
  800a91:	74 0d                	je     800aa0 <strnlen+0x23>
  800a93:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  800a97:	74 05                	je     800a9e <strnlen+0x21>
		n++;
  800a99:	83 c0 01             	add    $0x1,%eax
  800a9c:	eb f1                	jmp    800a8f <strnlen+0x12>
  800a9e:	89 c2                	mov    %eax,%edx
	return n;
}
  800aa0:	89 d0                	mov    %edx,%eax
  800aa2:	5d                   	pop    %ebp
  800aa3:	c3                   	ret    

00800aa4 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  800aa4:	f3 0f 1e fb          	endbr32 
  800aa8:	55                   	push   %ebp
  800aa9:	89 e5                	mov    %esp,%ebp
  800aab:	53                   	push   %ebx
  800aac:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800aaf:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  800ab2:	b8 00 00 00 00       	mov    $0x0,%eax
  800ab7:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  800abb:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  800abe:	83 c0 01             	add    $0x1,%eax
  800ac1:	84 d2                	test   %dl,%dl
  800ac3:	75 f2                	jne    800ab7 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  800ac5:	89 c8                	mov    %ecx,%eax
  800ac7:	5b                   	pop    %ebx
  800ac8:	5d                   	pop    %ebp
  800ac9:	c3                   	ret    

00800aca <strcat>:

char *
strcat(char *dst, const char *src)
{
  800aca:	f3 0f 1e fb          	endbr32 
  800ace:	55                   	push   %ebp
  800acf:	89 e5                	mov    %esp,%ebp
  800ad1:	53                   	push   %ebx
  800ad2:	83 ec 10             	sub    $0x10,%esp
  800ad5:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  800ad8:	53                   	push   %ebx
  800ad9:	e8 83 ff ff ff       	call   800a61 <strlen>
  800ade:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  800ae1:	ff 75 0c             	pushl  0xc(%ebp)
  800ae4:	01 d8                	add    %ebx,%eax
  800ae6:	50                   	push   %eax
  800ae7:	e8 b8 ff ff ff       	call   800aa4 <strcpy>
	return dst;
}
  800aec:	89 d8                	mov    %ebx,%eax
  800aee:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800af1:	c9                   	leave  
  800af2:	c3                   	ret    

00800af3 <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  800af3:	f3 0f 1e fb          	endbr32 
  800af7:	55                   	push   %ebp
  800af8:	89 e5                	mov    %esp,%ebp
  800afa:	56                   	push   %esi
  800afb:	53                   	push   %ebx
  800afc:	8b 75 08             	mov    0x8(%ebp),%esi
  800aff:	8b 55 0c             	mov    0xc(%ebp),%edx
  800b02:	89 f3                	mov    %esi,%ebx
  800b04:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800b07:	89 f0                	mov    %esi,%eax
  800b09:	39 d8                	cmp    %ebx,%eax
  800b0b:	74 11                	je     800b1e <strncpy+0x2b>
		*dst++ = *src;
  800b0d:	83 c0 01             	add    $0x1,%eax
  800b10:	0f b6 0a             	movzbl (%edx),%ecx
  800b13:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800b16:	80 f9 01             	cmp    $0x1,%cl
  800b19:	83 da ff             	sbb    $0xffffffff,%edx
  800b1c:	eb eb                	jmp    800b09 <strncpy+0x16>
	}
	return ret;
}
  800b1e:	89 f0                	mov    %esi,%eax
  800b20:	5b                   	pop    %ebx
  800b21:	5e                   	pop    %esi
  800b22:	5d                   	pop    %ebp
  800b23:	c3                   	ret    

00800b24 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800b24:	f3 0f 1e fb          	endbr32 
  800b28:	55                   	push   %ebp
  800b29:	89 e5                	mov    %esp,%ebp
  800b2b:	56                   	push   %esi
  800b2c:	53                   	push   %ebx
  800b2d:	8b 75 08             	mov    0x8(%ebp),%esi
  800b30:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800b33:	8b 55 10             	mov    0x10(%ebp),%edx
  800b36:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800b38:	85 d2                	test   %edx,%edx
  800b3a:	74 21                	je     800b5d <strlcpy+0x39>
  800b3c:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  800b40:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  800b42:	39 c2                	cmp    %eax,%edx
  800b44:	74 14                	je     800b5a <strlcpy+0x36>
  800b46:	0f b6 19             	movzbl (%ecx),%ebx
  800b49:	84 db                	test   %bl,%bl
  800b4b:	74 0b                	je     800b58 <strlcpy+0x34>
			*dst++ = *src++;
  800b4d:	83 c1 01             	add    $0x1,%ecx
  800b50:	83 c2 01             	add    $0x1,%edx
  800b53:	88 5a ff             	mov    %bl,-0x1(%edx)
  800b56:	eb ea                	jmp    800b42 <strlcpy+0x1e>
  800b58:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  800b5a:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  800b5d:	29 f0                	sub    %esi,%eax
}
  800b5f:	5b                   	pop    %ebx
  800b60:	5e                   	pop    %esi
  800b61:	5d                   	pop    %ebp
  800b62:	c3                   	ret    

00800b63 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  800b63:	f3 0f 1e fb          	endbr32 
  800b67:	55                   	push   %ebp
  800b68:	89 e5                	mov    %esp,%ebp
  800b6a:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800b6d:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  800b70:	0f b6 01             	movzbl (%ecx),%eax
  800b73:	84 c0                	test   %al,%al
  800b75:	74 0c                	je     800b83 <strcmp+0x20>
  800b77:	3a 02                	cmp    (%edx),%al
  800b79:	75 08                	jne    800b83 <strcmp+0x20>
		p++, q++;
  800b7b:	83 c1 01             	add    $0x1,%ecx
  800b7e:	83 c2 01             	add    $0x1,%edx
  800b81:	eb ed                	jmp    800b70 <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  800b83:	0f b6 c0             	movzbl %al,%eax
  800b86:	0f b6 12             	movzbl (%edx),%edx
  800b89:	29 d0                	sub    %edx,%eax
}
  800b8b:	5d                   	pop    %ebp
  800b8c:	c3                   	ret    

00800b8d <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  800b8d:	f3 0f 1e fb          	endbr32 
  800b91:	55                   	push   %ebp
  800b92:	89 e5                	mov    %esp,%ebp
  800b94:	53                   	push   %ebx
  800b95:	8b 45 08             	mov    0x8(%ebp),%eax
  800b98:	8b 55 0c             	mov    0xc(%ebp),%edx
  800b9b:	89 c3                	mov    %eax,%ebx
  800b9d:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  800ba0:	eb 06                	jmp    800ba8 <strncmp+0x1b>
		n--, p++, q++;
  800ba2:	83 c0 01             	add    $0x1,%eax
  800ba5:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  800ba8:	39 d8                	cmp    %ebx,%eax
  800baa:	74 16                	je     800bc2 <strncmp+0x35>
  800bac:	0f b6 08             	movzbl (%eax),%ecx
  800baf:	84 c9                	test   %cl,%cl
  800bb1:	74 04                	je     800bb7 <strncmp+0x2a>
  800bb3:	3a 0a                	cmp    (%edx),%cl
  800bb5:	74 eb                	je     800ba2 <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  800bb7:	0f b6 00             	movzbl (%eax),%eax
  800bba:	0f b6 12             	movzbl (%edx),%edx
  800bbd:	29 d0                	sub    %edx,%eax
}
  800bbf:	5b                   	pop    %ebx
  800bc0:	5d                   	pop    %ebp
  800bc1:	c3                   	ret    
		return 0;
  800bc2:	b8 00 00 00 00       	mov    $0x0,%eax
  800bc7:	eb f6                	jmp    800bbf <strncmp+0x32>

00800bc9 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  800bc9:	f3 0f 1e fb          	endbr32 
  800bcd:	55                   	push   %ebp
  800bce:	89 e5                	mov    %esp,%ebp
  800bd0:	8b 45 08             	mov    0x8(%ebp),%eax
  800bd3:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800bd7:	0f b6 10             	movzbl (%eax),%edx
  800bda:	84 d2                	test   %dl,%dl
  800bdc:	74 09                	je     800be7 <strchr+0x1e>
		if (*s == c)
  800bde:	38 ca                	cmp    %cl,%dl
  800be0:	74 0a                	je     800bec <strchr+0x23>
	for (; *s; s++)
  800be2:	83 c0 01             	add    $0x1,%eax
  800be5:	eb f0                	jmp    800bd7 <strchr+0xe>
			return (char *) s;
	return 0;
  800be7:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800bec:	5d                   	pop    %ebp
  800bed:	c3                   	ret    

00800bee <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  800bee:	f3 0f 1e fb          	endbr32 
  800bf2:	55                   	push   %ebp
  800bf3:	89 e5                	mov    %esp,%ebp
  800bf5:	8b 45 08             	mov    0x8(%ebp),%eax
  800bf8:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800bfc:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  800bff:	38 ca                	cmp    %cl,%dl
  800c01:	74 09                	je     800c0c <strfind+0x1e>
  800c03:	84 d2                	test   %dl,%dl
  800c05:	74 05                	je     800c0c <strfind+0x1e>
	for (; *s; s++)
  800c07:	83 c0 01             	add    $0x1,%eax
  800c0a:	eb f0                	jmp    800bfc <strfind+0xe>
			break;
	return (char *) s;
}
  800c0c:	5d                   	pop    %ebp
  800c0d:	c3                   	ret    

00800c0e <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800c0e:	f3 0f 1e fb          	endbr32 
  800c12:	55                   	push   %ebp
  800c13:	89 e5                	mov    %esp,%ebp
  800c15:	57                   	push   %edi
  800c16:	56                   	push   %esi
  800c17:	53                   	push   %ebx
  800c18:	8b 7d 08             	mov    0x8(%ebp),%edi
  800c1b:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800c1e:	85 c9                	test   %ecx,%ecx
  800c20:	74 31                	je     800c53 <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  800c22:	89 f8                	mov    %edi,%eax
  800c24:	09 c8                	or     %ecx,%eax
  800c26:	a8 03                	test   $0x3,%al
  800c28:	75 23                	jne    800c4d <memset+0x3f>
		c &= 0xFF;
  800c2a:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800c2e:	89 d3                	mov    %edx,%ebx
  800c30:	c1 e3 08             	shl    $0x8,%ebx
  800c33:	89 d0                	mov    %edx,%eax
  800c35:	c1 e0 18             	shl    $0x18,%eax
  800c38:	89 d6                	mov    %edx,%esi
  800c3a:	c1 e6 10             	shl    $0x10,%esi
  800c3d:	09 f0                	or     %esi,%eax
  800c3f:	09 c2                	or     %eax,%edx
  800c41:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  800c43:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800c46:	89 d0                	mov    %edx,%eax
  800c48:	fc                   	cld    
  800c49:	f3 ab                	rep stos %eax,%es:(%edi)
  800c4b:	eb 06                	jmp    800c53 <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800c4d:	8b 45 0c             	mov    0xc(%ebp),%eax
  800c50:	fc                   	cld    
  800c51:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  800c53:	89 f8                	mov    %edi,%eax
  800c55:	5b                   	pop    %ebx
  800c56:	5e                   	pop    %esi
  800c57:	5f                   	pop    %edi
  800c58:	5d                   	pop    %ebp
  800c59:	c3                   	ret    

00800c5a <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800c5a:	f3 0f 1e fb          	endbr32 
  800c5e:	55                   	push   %ebp
  800c5f:	89 e5                	mov    %esp,%ebp
  800c61:	57                   	push   %edi
  800c62:	56                   	push   %esi
  800c63:	8b 45 08             	mov    0x8(%ebp),%eax
  800c66:	8b 75 0c             	mov    0xc(%ebp),%esi
  800c69:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800c6c:	39 c6                	cmp    %eax,%esi
  800c6e:	73 32                	jae    800ca2 <memmove+0x48>
  800c70:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  800c73:	39 c2                	cmp    %eax,%edx
  800c75:	76 2b                	jbe    800ca2 <memmove+0x48>
		s += n;
		d += n;
  800c77:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800c7a:	89 fe                	mov    %edi,%esi
  800c7c:	09 ce                	or     %ecx,%esi
  800c7e:	09 d6                	or     %edx,%esi
  800c80:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800c86:	75 0e                	jne    800c96 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800c88:	83 ef 04             	sub    $0x4,%edi
  800c8b:	8d 72 fc             	lea    -0x4(%edx),%esi
  800c8e:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  800c91:	fd                   	std    
  800c92:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800c94:	eb 09                	jmp    800c9f <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800c96:	83 ef 01             	sub    $0x1,%edi
  800c99:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800c9c:	fd                   	std    
  800c9d:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  800c9f:	fc                   	cld    
  800ca0:	eb 1a                	jmp    800cbc <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800ca2:	89 c2                	mov    %eax,%edx
  800ca4:	09 ca                	or     %ecx,%edx
  800ca6:	09 f2                	or     %esi,%edx
  800ca8:	f6 c2 03             	test   $0x3,%dl
  800cab:	75 0a                	jne    800cb7 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800cad:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  800cb0:	89 c7                	mov    %eax,%edi
  800cb2:	fc                   	cld    
  800cb3:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800cb5:	eb 05                	jmp    800cbc <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800cb7:	89 c7                	mov    %eax,%edi
  800cb9:	fc                   	cld    
  800cba:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800cbc:	5e                   	pop    %esi
  800cbd:	5f                   	pop    %edi
  800cbe:	5d                   	pop    %ebp
  800cbf:	c3                   	ret    

00800cc0 <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800cc0:	f3 0f 1e fb          	endbr32 
  800cc4:	55                   	push   %ebp
  800cc5:	89 e5                	mov    %esp,%ebp
  800cc7:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800cca:	ff 75 10             	pushl  0x10(%ebp)
  800ccd:	ff 75 0c             	pushl  0xc(%ebp)
  800cd0:	ff 75 08             	pushl  0x8(%ebp)
  800cd3:	e8 82 ff ff ff       	call   800c5a <memmove>
}
  800cd8:	c9                   	leave  
  800cd9:	c3                   	ret    

00800cda <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800cda:	f3 0f 1e fb          	endbr32 
  800cde:	55                   	push   %ebp
  800cdf:	89 e5                	mov    %esp,%ebp
  800ce1:	56                   	push   %esi
  800ce2:	53                   	push   %ebx
  800ce3:	8b 45 08             	mov    0x8(%ebp),%eax
  800ce6:	8b 55 0c             	mov    0xc(%ebp),%edx
  800ce9:	89 c6                	mov    %eax,%esi
  800ceb:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800cee:	39 f0                	cmp    %esi,%eax
  800cf0:	74 1c                	je     800d0e <memcmp+0x34>
		if (*s1 != *s2)
  800cf2:	0f b6 08             	movzbl (%eax),%ecx
  800cf5:	0f b6 1a             	movzbl (%edx),%ebx
  800cf8:	38 d9                	cmp    %bl,%cl
  800cfa:	75 08                	jne    800d04 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800cfc:	83 c0 01             	add    $0x1,%eax
  800cff:	83 c2 01             	add    $0x1,%edx
  800d02:	eb ea                	jmp    800cee <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800d04:	0f b6 c1             	movzbl %cl,%eax
  800d07:	0f b6 db             	movzbl %bl,%ebx
  800d0a:	29 d8                	sub    %ebx,%eax
  800d0c:	eb 05                	jmp    800d13 <memcmp+0x39>
	}

	return 0;
  800d0e:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800d13:	5b                   	pop    %ebx
  800d14:	5e                   	pop    %esi
  800d15:	5d                   	pop    %ebp
  800d16:	c3                   	ret    

00800d17 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800d17:	f3 0f 1e fb          	endbr32 
  800d1b:	55                   	push   %ebp
  800d1c:	89 e5                	mov    %esp,%ebp
  800d1e:	8b 45 08             	mov    0x8(%ebp),%eax
  800d21:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800d24:	89 c2                	mov    %eax,%edx
  800d26:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800d29:	39 d0                	cmp    %edx,%eax
  800d2b:	73 09                	jae    800d36 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800d2d:	38 08                	cmp    %cl,(%eax)
  800d2f:	74 05                	je     800d36 <memfind+0x1f>
	for (; s < ends; s++)
  800d31:	83 c0 01             	add    $0x1,%eax
  800d34:	eb f3                	jmp    800d29 <memfind+0x12>
			break;
	return (void *) s;
}
  800d36:	5d                   	pop    %ebp
  800d37:	c3                   	ret    

00800d38 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800d38:	f3 0f 1e fb          	endbr32 
  800d3c:	55                   	push   %ebp
  800d3d:	89 e5                	mov    %esp,%ebp
  800d3f:	57                   	push   %edi
  800d40:	56                   	push   %esi
  800d41:	53                   	push   %ebx
  800d42:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800d45:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800d48:	eb 03                	jmp    800d4d <strtol+0x15>
		s++;
  800d4a:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800d4d:	0f b6 01             	movzbl (%ecx),%eax
  800d50:	3c 20                	cmp    $0x20,%al
  800d52:	74 f6                	je     800d4a <strtol+0x12>
  800d54:	3c 09                	cmp    $0x9,%al
  800d56:	74 f2                	je     800d4a <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800d58:	3c 2b                	cmp    $0x2b,%al
  800d5a:	74 2a                	je     800d86 <strtol+0x4e>
	int neg = 0;
  800d5c:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800d61:	3c 2d                	cmp    $0x2d,%al
  800d63:	74 2b                	je     800d90 <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800d65:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800d6b:	75 0f                	jne    800d7c <strtol+0x44>
  800d6d:	80 39 30             	cmpb   $0x30,(%ecx)
  800d70:	74 28                	je     800d9a <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800d72:	85 db                	test   %ebx,%ebx
  800d74:	b8 0a 00 00 00       	mov    $0xa,%eax
  800d79:	0f 44 d8             	cmove  %eax,%ebx
  800d7c:	b8 00 00 00 00       	mov    $0x0,%eax
  800d81:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800d84:	eb 46                	jmp    800dcc <strtol+0x94>
		s++;
  800d86:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800d89:	bf 00 00 00 00       	mov    $0x0,%edi
  800d8e:	eb d5                	jmp    800d65 <strtol+0x2d>
		s++, neg = 1;
  800d90:	83 c1 01             	add    $0x1,%ecx
  800d93:	bf 01 00 00 00       	mov    $0x1,%edi
  800d98:	eb cb                	jmp    800d65 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800d9a:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800d9e:	74 0e                	je     800dae <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800da0:	85 db                	test   %ebx,%ebx
  800da2:	75 d8                	jne    800d7c <strtol+0x44>
		s++, base = 8;
  800da4:	83 c1 01             	add    $0x1,%ecx
  800da7:	bb 08 00 00 00       	mov    $0x8,%ebx
  800dac:	eb ce                	jmp    800d7c <strtol+0x44>
		s += 2, base = 16;
  800dae:	83 c1 02             	add    $0x2,%ecx
  800db1:	bb 10 00 00 00       	mov    $0x10,%ebx
  800db6:	eb c4                	jmp    800d7c <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800db8:	0f be d2             	movsbl %dl,%edx
  800dbb:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800dbe:	3b 55 10             	cmp    0x10(%ebp),%edx
  800dc1:	7d 3a                	jge    800dfd <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800dc3:	83 c1 01             	add    $0x1,%ecx
  800dc6:	0f af 45 10          	imul   0x10(%ebp),%eax
  800dca:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800dcc:	0f b6 11             	movzbl (%ecx),%edx
  800dcf:	8d 72 d0             	lea    -0x30(%edx),%esi
  800dd2:	89 f3                	mov    %esi,%ebx
  800dd4:	80 fb 09             	cmp    $0x9,%bl
  800dd7:	76 df                	jbe    800db8 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800dd9:	8d 72 9f             	lea    -0x61(%edx),%esi
  800ddc:	89 f3                	mov    %esi,%ebx
  800dde:	80 fb 19             	cmp    $0x19,%bl
  800de1:	77 08                	ja     800deb <strtol+0xb3>
			dig = *s - 'a' + 10;
  800de3:	0f be d2             	movsbl %dl,%edx
  800de6:	83 ea 57             	sub    $0x57,%edx
  800de9:	eb d3                	jmp    800dbe <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800deb:	8d 72 bf             	lea    -0x41(%edx),%esi
  800dee:	89 f3                	mov    %esi,%ebx
  800df0:	80 fb 19             	cmp    $0x19,%bl
  800df3:	77 08                	ja     800dfd <strtol+0xc5>
			dig = *s - 'A' + 10;
  800df5:	0f be d2             	movsbl %dl,%edx
  800df8:	83 ea 37             	sub    $0x37,%edx
  800dfb:	eb c1                	jmp    800dbe <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800dfd:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800e01:	74 05                	je     800e08 <strtol+0xd0>
		*endptr = (char *) s;
  800e03:	8b 75 0c             	mov    0xc(%ebp),%esi
  800e06:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800e08:	89 c2                	mov    %eax,%edx
  800e0a:	f7 da                	neg    %edx
  800e0c:	85 ff                	test   %edi,%edi
  800e0e:	0f 45 c2             	cmovne %edx,%eax
}
  800e11:	5b                   	pop    %ebx
  800e12:	5e                   	pop    %esi
  800e13:	5f                   	pop    %edi
  800e14:	5d                   	pop    %ebp
  800e15:	c3                   	ret    

00800e16 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800e16:	f3 0f 1e fb          	endbr32 
  800e1a:	55                   	push   %ebp
  800e1b:	89 e5                	mov    %esp,%ebp
  800e1d:	57                   	push   %edi
  800e1e:	56                   	push   %esi
  800e1f:	53                   	push   %ebx
	asm volatile("int %1\n"
  800e20:	b8 00 00 00 00       	mov    $0x0,%eax
  800e25:	8b 55 08             	mov    0x8(%ebp),%edx
  800e28:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e2b:	89 c3                	mov    %eax,%ebx
  800e2d:	89 c7                	mov    %eax,%edi
  800e2f:	89 c6                	mov    %eax,%esi
  800e31:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800e33:	5b                   	pop    %ebx
  800e34:	5e                   	pop    %esi
  800e35:	5f                   	pop    %edi
  800e36:	5d                   	pop    %ebp
  800e37:	c3                   	ret    

00800e38 <sys_cgetc>:

int
sys_cgetc(void)
{
  800e38:	f3 0f 1e fb          	endbr32 
  800e3c:	55                   	push   %ebp
  800e3d:	89 e5                	mov    %esp,%ebp
  800e3f:	57                   	push   %edi
  800e40:	56                   	push   %esi
  800e41:	53                   	push   %ebx
	asm volatile("int %1\n"
  800e42:	ba 00 00 00 00       	mov    $0x0,%edx
  800e47:	b8 01 00 00 00       	mov    $0x1,%eax
  800e4c:	89 d1                	mov    %edx,%ecx
  800e4e:	89 d3                	mov    %edx,%ebx
  800e50:	89 d7                	mov    %edx,%edi
  800e52:	89 d6                	mov    %edx,%esi
  800e54:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800e56:	5b                   	pop    %ebx
  800e57:	5e                   	pop    %esi
  800e58:	5f                   	pop    %edi
  800e59:	5d                   	pop    %ebp
  800e5a:	c3                   	ret    

00800e5b <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800e5b:	f3 0f 1e fb          	endbr32 
  800e5f:	55                   	push   %ebp
  800e60:	89 e5                	mov    %esp,%ebp
  800e62:	57                   	push   %edi
  800e63:	56                   	push   %esi
  800e64:	53                   	push   %ebx
  800e65:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e68:	b9 00 00 00 00       	mov    $0x0,%ecx
  800e6d:	8b 55 08             	mov    0x8(%ebp),%edx
  800e70:	b8 03 00 00 00       	mov    $0x3,%eax
  800e75:	89 cb                	mov    %ecx,%ebx
  800e77:	89 cf                	mov    %ecx,%edi
  800e79:	89 ce                	mov    %ecx,%esi
  800e7b:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e7d:	85 c0                	test   %eax,%eax
  800e7f:	7f 08                	jg     800e89 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800e81:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e84:	5b                   	pop    %ebx
  800e85:	5e                   	pop    %esi
  800e86:	5f                   	pop    %edi
  800e87:	5d                   	pop    %ebp
  800e88:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e89:	83 ec 0c             	sub    $0xc,%esp
  800e8c:	50                   	push   %eax
  800e8d:	6a 03                	push   $0x3
  800e8f:	68 4f 25 80 00       	push   $0x80254f
  800e94:	6a 23                	push   $0x23
  800e96:	68 6c 25 80 00       	push   $0x80256c
  800e9b:	e8 50 f4 ff ff       	call   8002f0 <_panic>

00800ea0 <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800ea0:	f3 0f 1e fb          	endbr32 
  800ea4:	55                   	push   %ebp
  800ea5:	89 e5                	mov    %esp,%ebp
  800ea7:	57                   	push   %edi
  800ea8:	56                   	push   %esi
  800ea9:	53                   	push   %ebx
	asm volatile("int %1\n"
  800eaa:	ba 00 00 00 00       	mov    $0x0,%edx
  800eaf:	b8 02 00 00 00       	mov    $0x2,%eax
  800eb4:	89 d1                	mov    %edx,%ecx
  800eb6:	89 d3                	mov    %edx,%ebx
  800eb8:	89 d7                	mov    %edx,%edi
  800eba:	89 d6                	mov    %edx,%esi
  800ebc:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800ebe:	5b                   	pop    %ebx
  800ebf:	5e                   	pop    %esi
  800ec0:	5f                   	pop    %edi
  800ec1:	5d                   	pop    %ebp
  800ec2:	c3                   	ret    

00800ec3 <sys_yield>:

void
sys_yield(void)
{
  800ec3:	f3 0f 1e fb          	endbr32 
  800ec7:	55                   	push   %ebp
  800ec8:	89 e5                	mov    %esp,%ebp
  800eca:	57                   	push   %edi
  800ecb:	56                   	push   %esi
  800ecc:	53                   	push   %ebx
	asm volatile("int %1\n"
  800ecd:	ba 00 00 00 00       	mov    $0x0,%edx
  800ed2:	b8 0b 00 00 00       	mov    $0xb,%eax
  800ed7:	89 d1                	mov    %edx,%ecx
  800ed9:	89 d3                	mov    %edx,%ebx
  800edb:	89 d7                	mov    %edx,%edi
  800edd:	89 d6                	mov    %edx,%esi
  800edf:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800ee1:	5b                   	pop    %ebx
  800ee2:	5e                   	pop    %esi
  800ee3:	5f                   	pop    %edi
  800ee4:	5d                   	pop    %ebp
  800ee5:	c3                   	ret    

00800ee6 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800ee6:	f3 0f 1e fb          	endbr32 
  800eea:	55                   	push   %ebp
  800eeb:	89 e5                	mov    %esp,%ebp
  800eed:	57                   	push   %edi
  800eee:	56                   	push   %esi
  800eef:	53                   	push   %ebx
  800ef0:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800ef3:	be 00 00 00 00       	mov    $0x0,%esi
  800ef8:	8b 55 08             	mov    0x8(%ebp),%edx
  800efb:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800efe:	b8 04 00 00 00       	mov    $0x4,%eax
  800f03:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800f06:	89 f7                	mov    %esi,%edi
  800f08:	cd 30                	int    $0x30
	if(check && ret > 0)
  800f0a:	85 c0                	test   %eax,%eax
  800f0c:	7f 08                	jg     800f16 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800f0e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800f11:	5b                   	pop    %ebx
  800f12:	5e                   	pop    %esi
  800f13:	5f                   	pop    %edi
  800f14:	5d                   	pop    %ebp
  800f15:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800f16:	83 ec 0c             	sub    $0xc,%esp
  800f19:	50                   	push   %eax
  800f1a:	6a 04                	push   $0x4
  800f1c:	68 4f 25 80 00       	push   $0x80254f
  800f21:	6a 23                	push   $0x23
  800f23:	68 6c 25 80 00       	push   $0x80256c
  800f28:	e8 c3 f3 ff ff       	call   8002f0 <_panic>

00800f2d <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800f2d:	f3 0f 1e fb          	endbr32 
  800f31:	55                   	push   %ebp
  800f32:	89 e5                	mov    %esp,%ebp
  800f34:	57                   	push   %edi
  800f35:	56                   	push   %esi
  800f36:	53                   	push   %ebx
  800f37:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800f3a:	8b 55 08             	mov    0x8(%ebp),%edx
  800f3d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800f40:	b8 05 00 00 00       	mov    $0x5,%eax
  800f45:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800f48:	8b 7d 14             	mov    0x14(%ebp),%edi
  800f4b:	8b 75 18             	mov    0x18(%ebp),%esi
  800f4e:	cd 30                	int    $0x30
	if(check && ret > 0)
  800f50:	85 c0                	test   %eax,%eax
  800f52:	7f 08                	jg     800f5c <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800f54:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800f57:	5b                   	pop    %ebx
  800f58:	5e                   	pop    %esi
  800f59:	5f                   	pop    %edi
  800f5a:	5d                   	pop    %ebp
  800f5b:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800f5c:	83 ec 0c             	sub    $0xc,%esp
  800f5f:	50                   	push   %eax
  800f60:	6a 05                	push   $0x5
  800f62:	68 4f 25 80 00       	push   $0x80254f
  800f67:	6a 23                	push   $0x23
  800f69:	68 6c 25 80 00       	push   $0x80256c
  800f6e:	e8 7d f3 ff ff       	call   8002f0 <_panic>

00800f73 <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800f73:	f3 0f 1e fb          	endbr32 
  800f77:	55                   	push   %ebp
  800f78:	89 e5                	mov    %esp,%ebp
  800f7a:	57                   	push   %edi
  800f7b:	56                   	push   %esi
  800f7c:	53                   	push   %ebx
  800f7d:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800f80:	bb 00 00 00 00       	mov    $0x0,%ebx
  800f85:	8b 55 08             	mov    0x8(%ebp),%edx
  800f88:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800f8b:	b8 06 00 00 00       	mov    $0x6,%eax
  800f90:	89 df                	mov    %ebx,%edi
  800f92:	89 de                	mov    %ebx,%esi
  800f94:	cd 30                	int    $0x30
	if(check && ret > 0)
  800f96:	85 c0                	test   %eax,%eax
  800f98:	7f 08                	jg     800fa2 <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800f9a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800f9d:	5b                   	pop    %ebx
  800f9e:	5e                   	pop    %esi
  800f9f:	5f                   	pop    %edi
  800fa0:	5d                   	pop    %ebp
  800fa1:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800fa2:	83 ec 0c             	sub    $0xc,%esp
  800fa5:	50                   	push   %eax
  800fa6:	6a 06                	push   $0x6
  800fa8:	68 4f 25 80 00       	push   $0x80254f
  800fad:	6a 23                	push   $0x23
  800faf:	68 6c 25 80 00       	push   $0x80256c
  800fb4:	e8 37 f3 ff ff       	call   8002f0 <_panic>

00800fb9 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800fb9:	f3 0f 1e fb          	endbr32 
  800fbd:	55                   	push   %ebp
  800fbe:	89 e5                	mov    %esp,%ebp
  800fc0:	57                   	push   %edi
  800fc1:	56                   	push   %esi
  800fc2:	53                   	push   %ebx
  800fc3:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800fc6:	bb 00 00 00 00       	mov    $0x0,%ebx
  800fcb:	8b 55 08             	mov    0x8(%ebp),%edx
  800fce:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800fd1:	b8 08 00 00 00       	mov    $0x8,%eax
  800fd6:	89 df                	mov    %ebx,%edi
  800fd8:	89 de                	mov    %ebx,%esi
  800fda:	cd 30                	int    $0x30
	if(check && ret > 0)
  800fdc:	85 c0                	test   %eax,%eax
  800fde:	7f 08                	jg     800fe8 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800fe0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800fe3:	5b                   	pop    %ebx
  800fe4:	5e                   	pop    %esi
  800fe5:	5f                   	pop    %edi
  800fe6:	5d                   	pop    %ebp
  800fe7:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800fe8:	83 ec 0c             	sub    $0xc,%esp
  800feb:	50                   	push   %eax
  800fec:	6a 08                	push   $0x8
  800fee:	68 4f 25 80 00       	push   $0x80254f
  800ff3:	6a 23                	push   $0x23
  800ff5:	68 6c 25 80 00       	push   $0x80256c
  800ffa:	e8 f1 f2 ff ff       	call   8002f0 <_panic>

00800fff <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800fff:	f3 0f 1e fb          	endbr32 
  801003:	55                   	push   %ebp
  801004:	89 e5                	mov    %esp,%ebp
  801006:	57                   	push   %edi
  801007:	56                   	push   %esi
  801008:	53                   	push   %ebx
  801009:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  80100c:	bb 00 00 00 00       	mov    $0x0,%ebx
  801011:	8b 55 08             	mov    0x8(%ebp),%edx
  801014:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801017:	b8 09 00 00 00       	mov    $0x9,%eax
  80101c:	89 df                	mov    %ebx,%edi
  80101e:	89 de                	mov    %ebx,%esi
  801020:	cd 30                	int    $0x30
	if(check && ret > 0)
  801022:	85 c0                	test   %eax,%eax
  801024:	7f 08                	jg     80102e <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  801026:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801029:	5b                   	pop    %ebx
  80102a:	5e                   	pop    %esi
  80102b:	5f                   	pop    %edi
  80102c:	5d                   	pop    %ebp
  80102d:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  80102e:	83 ec 0c             	sub    $0xc,%esp
  801031:	50                   	push   %eax
  801032:	6a 09                	push   $0x9
  801034:	68 4f 25 80 00       	push   $0x80254f
  801039:	6a 23                	push   $0x23
  80103b:	68 6c 25 80 00       	push   $0x80256c
  801040:	e8 ab f2 ff ff       	call   8002f0 <_panic>

00801045 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  801045:	f3 0f 1e fb          	endbr32 
  801049:	55                   	push   %ebp
  80104a:	89 e5                	mov    %esp,%ebp
  80104c:	57                   	push   %edi
  80104d:	56                   	push   %esi
  80104e:	53                   	push   %ebx
  80104f:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  801052:	bb 00 00 00 00       	mov    $0x0,%ebx
  801057:	8b 55 08             	mov    0x8(%ebp),%edx
  80105a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80105d:	b8 0a 00 00 00       	mov    $0xa,%eax
  801062:	89 df                	mov    %ebx,%edi
  801064:	89 de                	mov    %ebx,%esi
  801066:	cd 30                	int    $0x30
	if(check && ret > 0)
  801068:	85 c0                	test   %eax,%eax
  80106a:	7f 08                	jg     801074 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  80106c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80106f:	5b                   	pop    %ebx
  801070:	5e                   	pop    %esi
  801071:	5f                   	pop    %edi
  801072:	5d                   	pop    %ebp
  801073:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  801074:	83 ec 0c             	sub    $0xc,%esp
  801077:	50                   	push   %eax
  801078:	6a 0a                	push   $0xa
  80107a:	68 4f 25 80 00       	push   $0x80254f
  80107f:	6a 23                	push   $0x23
  801081:	68 6c 25 80 00       	push   $0x80256c
  801086:	e8 65 f2 ff ff       	call   8002f0 <_panic>

0080108b <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  80108b:	f3 0f 1e fb          	endbr32 
  80108f:	55                   	push   %ebp
  801090:	89 e5                	mov    %esp,%ebp
  801092:	57                   	push   %edi
  801093:	56                   	push   %esi
  801094:	53                   	push   %ebx
	asm volatile("int %1\n"
  801095:	8b 55 08             	mov    0x8(%ebp),%edx
  801098:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80109b:	b8 0c 00 00 00       	mov    $0xc,%eax
  8010a0:	be 00 00 00 00       	mov    $0x0,%esi
  8010a5:	8b 5d 10             	mov    0x10(%ebp),%ebx
  8010a8:	8b 7d 14             	mov    0x14(%ebp),%edi
  8010ab:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  8010ad:	5b                   	pop    %ebx
  8010ae:	5e                   	pop    %esi
  8010af:	5f                   	pop    %edi
  8010b0:	5d                   	pop    %ebp
  8010b1:	c3                   	ret    

008010b2 <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  8010b2:	f3 0f 1e fb          	endbr32 
  8010b6:	55                   	push   %ebp
  8010b7:	89 e5                	mov    %esp,%ebp
  8010b9:	57                   	push   %edi
  8010ba:	56                   	push   %esi
  8010bb:	53                   	push   %ebx
  8010bc:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  8010bf:	b9 00 00 00 00       	mov    $0x0,%ecx
  8010c4:	8b 55 08             	mov    0x8(%ebp),%edx
  8010c7:	b8 0d 00 00 00       	mov    $0xd,%eax
  8010cc:	89 cb                	mov    %ecx,%ebx
  8010ce:	89 cf                	mov    %ecx,%edi
  8010d0:	89 ce                	mov    %ecx,%esi
  8010d2:	cd 30                	int    $0x30
	if(check && ret > 0)
  8010d4:	85 c0                	test   %eax,%eax
  8010d6:	7f 08                	jg     8010e0 <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  8010d8:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8010db:	5b                   	pop    %ebx
  8010dc:	5e                   	pop    %esi
  8010dd:	5f                   	pop    %edi
  8010de:	5d                   	pop    %ebp
  8010df:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  8010e0:	83 ec 0c             	sub    $0xc,%esp
  8010e3:	50                   	push   %eax
  8010e4:	6a 0d                	push   $0xd
  8010e6:	68 4f 25 80 00       	push   $0x80254f
  8010eb:	6a 23                	push   $0x23
  8010ed:	68 6c 25 80 00       	push   $0x80256c
  8010f2:	e8 f9 f1 ff ff       	call   8002f0 <_panic>

008010f7 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  8010f7:	f3 0f 1e fb          	endbr32 
  8010fb:	55                   	push   %ebp
  8010fc:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8010fe:	8b 45 08             	mov    0x8(%ebp),%eax
  801101:	05 00 00 00 30       	add    $0x30000000,%eax
  801106:	c1 e8 0c             	shr    $0xc,%eax
}
  801109:	5d                   	pop    %ebp
  80110a:	c3                   	ret    

0080110b <fd2data>:

char*
fd2data(struct Fd *fd)
{
  80110b:	f3 0f 1e fb          	endbr32 
  80110f:	55                   	push   %ebp
  801110:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801112:	8b 45 08             	mov    0x8(%ebp),%eax
  801115:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  80111a:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  80111f:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  801124:	5d                   	pop    %ebp
  801125:	c3                   	ret    

00801126 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  801126:	f3 0f 1e fb          	endbr32 
  80112a:	55                   	push   %ebp
  80112b:	89 e5                	mov    %esp,%ebp
  80112d:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  801132:	89 c2                	mov    %eax,%edx
  801134:	c1 ea 16             	shr    $0x16,%edx
  801137:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  80113e:	f6 c2 01             	test   $0x1,%dl
  801141:	74 2d                	je     801170 <fd_alloc+0x4a>
  801143:	89 c2                	mov    %eax,%edx
  801145:	c1 ea 0c             	shr    $0xc,%edx
  801148:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  80114f:	f6 c2 01             	test   $0x1,%dl
  801152:	74 1c                	je     801170 <fd_alloc+0x4a>
  801154:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  801159:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  80115e:	75 d2                	jne    801132 <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  801160:	8b 45 08             	mov    0x8(%ebp),%eax
  801163:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  801169:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  80116e:	eb 0a                	jmp    80117a <fd_alloc+0x54>
			*fd_store = fd;
  801170:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801173:	89 01                	mov    %eax,(%ecx)
			return 0;
  801175:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80117a:	5d                   	pop    %ebp
  80117b:	c3                   	ret    

0080117c <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  80117c:	f3 0f 1e fb          	endbr32 
  801180:	55                   	push   %ebp
  801181:	89 e5                	mov    %esp,%ebp
  801183:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  801186:	83 f8 1f             	cmp    $0x1f,%eax
  801189:	77 30                	ja     8011bb <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  80118b:	c1 e0 0c             	shl    $0xc,%eax
  80118e:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  801193:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  801199:	f6 c2 01             	test   $0x1,%dl
  80119c:	74 24                	je     8011c2 <fd_lookup+0x46>
  80119e:	89 c2                	mov    %eax,%edx
  8011a0:	c1 ea 0c             	shr    $0xc,%edx
  8011a3:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  8011aa:	f6 c2 01             	test   $0x1,%dl
  8011ad:	74 1a                	je     8011c9 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  8011af:	8b 55 0c             	mov    0xc(%ebp),%edx
  8011b2:	89 02                	mov    %eax,(%edx)
	return 0;
  8011b4:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8011b9:	5d                   	pop    %ebp
  8011ba:	c3                   	ret    
		return -E_INVAL;
  8011bb:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8011c0:	eb f7                	jmp    8011b9 <fd_lookup+0x3d>
		return -E_INVAL;
  8011c2:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8011c7:	eb f0                	jmp    8011b9 <fd_lookup+0x3d>
  8011c9:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8011ce:	eb e9                	jmp    8011b9 <fd_lookup+0x3d>

008011d0 <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  8011d0:	f3 0f 1e fb          	endbr32 
  8011d4:	55                   	push   %ebp
  8011d5:	89 e5                	mov    %esp,%ebp
  8011d7:	83 ec 08             	sub    $0x8,%esp
  8011da:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8011dd:	ba f8 25 80 00       	mov    $0x8025f8,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  8011e2:	b8 20 30 80 00       	mov    $0x803020,%eax
		if (devtab[i]->dev_id == dev_id) {
  8011e7:	39 08                	cmp    %ecx,(%eax)
  8011e9:	74 33                	je     80121e <dev_lookup+0x4e>
  8011eb:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  8011ee:	8b 02                	mov    (%edx),%eax
  8011f0:	85 c0                	test   %eax,%eax
  8011f2:	75 f3                	jne    8011e7 <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  8011f4:	a1 04 44 80 00       	mov    0x804404,%eax
  8011f9:	8b 40 48             	mov    0x48(%eax),%eax
  8011fc:	83 ec 04             	sub    $0x4,%esp
  8011ff:	51                   	push   %ecx
  801200:	50                   	push   %eax
  801201:	68 7c 25 80 00       	push   $0x80257c
  801206:	e8 cc f1 ff ff       	call   8003d7 <cprintf>
	*dev = 0;
  80120b:	8b 45 0c             	mov    0xc(%ebp),%eax
  80120e:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  801214:	83 c4 10             	add    $0x10,%esp
  801217:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  80121c:	c9                   	leave  
  80121d:	c3                   	ret    
			*dev = devtab[i];
  80121e:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801221:	89 01                	mov    %eax,(%ecx)
			return 0;
  801223:	b8 00 00 00 00       	mov    $0x0,%eax
  801228:	eb f2                	jmp    80121c <dev_lookup+0x4c>

0080122a <fd_close>:
{
  80122a:	f3 0f 1e fb          	endbr32 
  80122e:	55                   	push   %ebp
  80122f:	89 e5                	mov    %esp,%ebp
  801231:	57                   	push   %edi
  801232:	56                   	push   %esi
  801233:	53                   	push   %ebx
  801234:	83 ec 24             	sub    $0x24,%esp
  801237:	8b 75 08             	mov    0x8(%ebp),%esi
  80123a:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  80123d:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  801240:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801241:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  801247:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  80124a:	50                   	push   %eax
  80124b:	e8 2c ff ff ff       	call   80117c <fd_lookup>
  801250:	89 c3                	mov    %eax,%ebx
  801252:	83 c4 10             	add    $0x10,%esp
  801255:	85 c0                	test   %eax,%eax
  801257:	78 05                	js     80125e <fd_close+0x34>
	    || fd != fd2)
  801259:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  80125c:	74 16                	je     801274 <fd_close+0x4a>
		return (must_exist ? r : 0);
  80125e:	89 f8                	mov    %edi,%eax
  801260:	84 c0                	test   %al,%al
  801262:	b8 00 00 00 00       	mov    $0x0,%eax
  801267:	0f 44 d8             	cmove  %eax,%ebx
}
  80126a:	89 d8                	mov    %ebx,%eax
  80126c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80126f:	5b                   	pop    %ebx
  801270:	5e                   	pop    %esi
  801271:	5f                   	pop    %edi
  801272:	5d                   	pop    %ebp
  801273:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  801274:	83 ec 08             	sub    $0x8,%esp
  801277:	8d 45 e0             	lea    -0x20(%ebp),%eax
  80127a:	50                   	push   %eax
  80127b:	ff 36                	pushl  (%esi)
  80127d:	e8 4e ff ff ff       	call   8011d0 <dev_lookup>
  801282:	89 c3                	mov    %eax,%ebx
  801284:	83 c4 10             	add    $0x10,%esp
  801287:	85 c0                	test   %eax,%eax
  801289:	78 1a                	js     8012a5 <fd_close+0x7b>
		if (dev->dev_close)
  80128b:	8b 45 e0             	mov    -0x20(%ebp),%eax
  80128e:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  801291:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  801296:	85 c0                	test   %eax,%eax
  801298:	74 0b                	je     8012a5 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  80129a:	83 ec 0c             	sub    $0xc,%esp
  80129d:	56                   	push   %esi
  80129e:	ff d0                	call   *%eax
  8012a0:	89 c3                	mov    %eax,%ebx
  8012a2:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  8012a5:	83 ec 08             	sub    $0x8,%esp
  8012a8:	56                   	push   %esi
  8012a9:	6a 00                	push   $0x0
  8012ab:	e8 c3 fc ff ff       	call   800f73 <sys_page_unmap>
	return r;
  8012b0:	83 c4 10             	add    $0x10,%esp
  8012b3:	eb b5                	jmp    80126a <fd_close+0x40>

008012b5 <close>:

int
close(int fdnum)
{
  8012b5:	f3 0f 1e fb          	endbr32 
  8012b9:	55                   	push   %ebp
  8012ba:	89 e5                	mov    %esp,%ebp
  8012bc:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8012bf:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8012c2:	50                   	push   %eax
  8012c3:	ff 75 08             	pushl  0x8(%ebp)
  8012c6:	e8 b1 fe ff ff       	call   80117c <fd_lookup>
  8012cb:	83 c4 10             	add    $0x10,%esp
  8012ce:	85 c0                	test   %eax,%eax
  8012d0:	79 02                	jns    8012d4 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  8012d2:	c9                   	leave  
  8012d3:	c3                   	ret    
		return fd_close(fd, 1);
  8012d4:	83 ec 08             	sub    $0x8,%esp
  8012d7:	6a 01                	push   $0x1
  8012d9:	ff 75 f4             	pushl  -0xc(%ebp)
  8012dc:	e8 49 ff ff ff       	call   80122a <fd_close>
  8012e1:	83 c4 10             	add    $0x10,%esp
  8012e4:	eb ec                	jmp    8012d2 <close+0x1d>

008012e6 <close_all>:

void
close_all(void)
{
  8012e6:	f3 0f 1e fb          	endbr32 
  8012ea:	55                   	push   %ebp
  8012eb:	89 e5                	mov    %esp,%ebp
  8012ed:	53                   	push   %ebx
  8012ee:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  8012f1:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  8012f6:	83 ec 0c             	sub    $0xc,%esp
  8012f9:	53                   	push   %ebx
  8012fa:	e8 b6 ff ff ff       	call   8012b5 <close>
	for (i = 0; i < MAXFD; i++)
  8012ff:	83 c3 01             	add    $0x1,%ebx
  801302:	83 c4 10             	add    $0x10,%esp
  801305:	83 fb 20             	cmp    $0x20,%ebx
  801308:	75 ec                	jne    8012f6 <close_all+0x10>
}
  80130a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80130d:	c9                   	leave  
  80130e:	c3                   	ret    

0080130f <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  80130f:	f3 0f 1e fb          	endbr32 
  801313:	55                   	push   %ebp
  801314:	89 e5                	mov    %esp,%ebp
  801316:	57                   	push   %edi
  801317:	56                   	push   %esi
  801318:	53                   	push   %ebx
  801319:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  80131c:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80131f:	50                   	push   %eax
  801320:	ff 75 08             	pushl  0x8(%ebp)
  801323:	e8 54 fe ff ff       	call   80117c <fd_lookup>
  801328:	89 c3                	mov    %eax,%ebx
  80132a:	83 c4 10             	add    $0x10,%esp
  80132d:	85 c0                	test   %eax,%eax
  80132f:	0f 88 81 00 00 00    	js     8013b6 <dup+0xa7>
		return r;
	close(newfdnum);
  801335:	83 ec 0c             	sub    $0xc,%esp
  801338:	ff 75 0c             	pushl  0xc(%ebp)
  80133b:	e8 75 ff ff ff       	call   8012b5 <close>

	newfd = INDEX2FD(newfdnum);
  801340:	8b 75 0c             	mov    0xc(%ebp),%esi
  801343:	c1 e6 0c             	shl    $0xc,%esi
  801346:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  80134c:	83 c4 04             	add    $0x4,%esp
  80134f:	ff 75 e4             	pushl  -0x1c(%ebp)
  801352:	e8 b4 fd ff ff       	call   80110b <fd2data>
  801357:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  801359:	89 34 24             	mov    %esi,(%esp)
  80135c:	e8 aa fd ff ff       	call   80110b <fd2data>
  801361:	83 c4 10             	add    $0x10,%esp
  801364:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  801366:	89 d8                	mov    %ebx,%eax
  801368:	c1 e8 16             	shr    $0x16,%eax
  80136b:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801372:	a8 01                	test   $0x1,%al
  801374:	74 11                	je     801387 <dup+0x78>
  801376:	89 d8                	mov    %ebx,%eax
  801378:	c1 e8 0c             	shr    $0xc,%eax
  80137b:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801382:	f6 c2 01             	test   $0x1,%dl
  801385:	75 39                	jne    8013c0 <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  801387:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  80138a:	89 d0                	mov    %edx,%eax
  80138c:	c1 e8 0c             	shr    $0xc,%eax
  80138f:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801396:	83 ec 0c             	sub    $0xc,%esp
  801399:	25 07 0e 00 00       	and    $0xe07,%eax
  80139e:	50                   	push   %eax
  80139f:	56                   	push   %esi
  8013a0:	6a 00                	push   $0x0
  8013a2:	52                   	push   %edx
  8013a3:	6a 00                	push   $0x0
  8013a5:	e8 83 fb ff ff       	call   800f2d <sys_page_map>
  8013aa:	89 c3                	mov    %eax,%ebx
  8013ac:	83 c4 20             	add    $0x20,%esp
  8013af:	85 c0                	test   %eax,%eax
  8013b1:	78 31                	js     8013e4 <dup+0xd5>
		goto err;

	return newfdnum;
  8013b3:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  8013b6:	89 d8                	mov    %ebx,%eax
  8013b8:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8013bb:	5b                   	pop    %ebx
  8013bc:	5e                   	pop    %esi
  8013bd:	5f                   	pop    %edi
  8013be:	5d                   	pop    %ebp
  8013bf:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  8013c0:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8013c7:	83 ec 0c             	sub    $0xc,%esp
  8013ca:	25 07 0e 00 00       	and    $0xe07,%eax
  8013cf:	50                   	push   %eax
  8013d0:	57                   	push   %edi
  8013d1:	6a 00                	push   $0x0
  8013d3:	53                   	push   %ebx
  8013d4:	6a 00                	push   $0x0
  8013d6:	e8 52 fb ff ff       	call   800f2d <sys_page_map>
  8013db:	89 c3                	mov    %eax,%ebx
  8013dd:	83 c4 20             	add    $0x20,%esp
  8013e0:	85 c0                	test   %eax,%eax
  8013e2:	79 a3                	jns    801387 <dup+0x78>
	sys_page_unmap(0, newfd);
  8013e4:	83 ec 08             	sub    $0x8,%esp
  8013e7:	56                   	push   %esi
  8013e8:	6a 00                	push   $0x0
  8013ea:	e8 84 fb ff ff       	call   800f73 <sys_page_unmap>
	sys_page_unmap(0, nva);
  8013ef:	83 c4 08             	add    $0x8,%esp
  8013f2:	57                   	push   %edi
  8013f3:	6a 00                	push   $0x0
  8013f5:	e8 79 fb ff ff       	call   800f73 <sys_page_unmap>
	return r;
  8013fa:	83 c4 10             	add    $0x10,%esp
  8013fd:	eb b7                	jmp    8013b6 <dup+0xa7>

008013ff <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  8013ff:	f3 0f 1e fb          	endbr32 
  801403:	55                   	push   %ebp
  801404:	89 e5                	mov    %esp,%ebp
  801406:	53                   	push   %ebx
  801407:	83 ec 1c             	sub    $0x1c,%esp
  80140a:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  80140d:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801410:	50                   	push   %eax
  801411:	53                   	push   %ebx
  801412:	e8 65 fd ff ff       	call   80117c <fd_lookup>
  801417:	83 c4 10             	add    $0x10,%esp
  80141a:	85 c0                	test   %eax,%eax
  80141c:	78 3f                	js     80145d <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80141e:	83 ec 08             	sub    $0x8,%esp
  801421:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801424:	50                   	push   %eax
  801425:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801428:	ff 30                	pushl  (%eax)
  80142a:	e8 a1 fd ff ff       	call   8011d0 <dev_lookup>
  80142f:	83 c4 10             	add    $0x10,%esp
  801432:	85 c0                	test   %eax,%eax
  801434:	78 27                	js     80145d <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  801436:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801439:	8b 42 08             	mov    0x8(%edx),%eax
  80143c:	83 e0 03             	and    $0x3,%eax
  80143f:	83 f8 01             	cmp    $0x1,%eax
  801442:	74 1e                	je     801462 <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  801444:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801447:	8b 40 08             	mov    0x8(%eax),%eax
  80144a:	85 c0                	test   %eax,%eax
  80144c:	74 35                	je     801483 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  80144e:	83 ec 04             	sub    $0x4,%esp
  801451:	ff 75 10             	pushl  0x10(%ebp)
  801454:	ff 75 0c             	pushl  0xc(%ebp)
  801457:	52                   	push   %edx
  801458:	ff d0                	call   *%eax
  80145a:	83 c4 10             	add    $0x10,%esp
}
  80145d:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801460:	c9                   	leave  
  801461:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  801462:	a1 04 44 80 00       	mov    0x804404,%eax
  801467:	8b 40 48             	mov    0x48(%eax),%eax
  80146a:	83 ec 04             	sub    $0x4,%esp
  80146d:	53                   	push   %ebx
  80146e:	50                   	push   %eax
  80146f:	68 bd 25 80 00       	push   $0x8025bd
  801474:	e8 5e ef ff ff       	call   8003d7 <cprintf>
		return -E_INVAL;
  801479:	83 c4 10             	add    $0x10,%esp
  80147c:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801481:	eb da                	jmp    80145d <read+0x5e>
		return -E_NOT_SUPP;
  801483:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801488:	eb d3                	jmp    80145d <read+0x5e>

0080148a <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  80148a:	f3 0f 1e fb          	endbr32 
  80148e:	55                   	push   %ebp
  80148f:	89 e5                	mov    %esp,%ebp
  801491:	57                   	push   %edi
  801492:	56                   	push   %esi
  801493:	53                   	push   %ebx
  801494:	83 ec 0c             	sub    $0xc,%esp
  801497:	8b 7d 08             	mov    0x8(%ebp),%edi
  80149a:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  80149d:	bb 00 00 00 00       	mov    $0x0,%ebx
  8014a2:	eb 02                	jmp    8014a6 <readn+0x1c>
  8014a4:	01 c3                	add    %eax,%ebx
  8014a6:	39 f3                	cmp    %esi,%ebx
  8014a8:	73 21                	jae    8014cb <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8014aa:	83 ec 04             	sub    $0x4,%esp
  8014ad:	89 f0                	mov    %esi,%eax
  8014af:	29 d8                	sub    %ebx,%eax
  8014b1:	50                   	push   %eax
  8014b2:	89 d8                	mov    %ebx,%eax
  8014b4:	03 45 0c             	add    0xc(%ebp),%eax
  8014b7:	50                   	push   %eax
  8014b8:	57                   	push   %edi
  8014b9:	e8 41 ff ff ff       	call   8013ff <read>
		if (m < 0)
  8014be:	83 c4 10             	add    $0x10,%esp
  8014c1:	85 c0                	test   %eax,%eax
  8014c3:	78 04                	js     8014c9 <readn+0x3f>
			return m;
		if (m == 0)
  8014c5:	75 dd                	jne    8014a4 <readn+0x1a>
  8014c7:	eb 02                	jmp    8014cb <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8014c9:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  8014cb:	89 d8                	mov    %ebx,%eax
  8014cd:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8014d0:	5b                   	pop    %ebx
  8014d1:	5e                   	pop    %esi
  8014d2:	5f                   	pop    %edi
  8014d3:	5d                   	pop    %ebp
  8014d4:	c3                   	ret    

008014d5 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  8014d5:	f3 0f 1e fb          	endbr32 
  8014d9:	55                   	push   %ebp
  8014da:	89 e5                	mov    %esp,%ebp
  8014dc:	53                   	push   %ebx
  8014dd:	83 ec 1c             	sub    $0x1c,%esp
  8014e0:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8014e3:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8014e6:	50                   	push   %eax
  8014e7:	53                   	push   %ebx
  8014e8:	e8 8f fc ff ff       	call   80117c <fd_lookup>
  8014ed:	83 c4 10             	add    $0x10,%esp
  8014f0:	85 c0                	test   %eax,%eax
  8014f2:	78 3a                	js     80152e <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8014f4:	83 ec 08             	sub    $0x8,%esp
  8014f7:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8014fa:	50                   	push   %eax
  8014fb:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8014fe:	ff 30                	pushl  (%eax)
  801500:	e8 cb fc ff ff       	call   8011d0 <dev_lookup>
  801505:	83 c4 10             	add    $0x10,%esp
  801508:	85 c0                	test   %eax,%eax
  80150a:	78 22                	js     80152e <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  80150c:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80150f:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801513:	74 1e                	je     801533 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  801515:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801518:	8b 52 0c             	mov    0xc(%edx),%edx
  80151b:	85 d2                	test   %edx,%edx
  80151d:	74 35                	je     801554 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  80151f:	83 ec 04             	sub    $0x4,%esp
  801522:	ff 75 10             	pushl  0x10(%ebp)
  801525:	ff 75 0c             	pushl  0xc(%ebp)
  801528:	50                   	push   %eax
  801529:	ff d2                	call   *%edx
  80152b:	83 c4 10             	add    $0x10,%esp
}
  80152e:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801531:	c9                   	leave  
  801532:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  801533:	a1 04 44 80 00       	mov    0x804404,%eax
  801538:	8b 40 48             	mov    0x48(%eax),%eax
  80153b:	83 ec 04             	sub    $0x4,%esp
  80153e:	53                   	push   %ebx
  80153f:	50                   	push   %eax
  801540:	68 d9 25 80 00       	push   $0x8025d9
  801545:	e8 8d ee ff ff       	call   8003d7 <cprintf>
		return -E_INVAL;
  80154a:	83 c4 10             	add    $0x10,%esp
  80154d:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801552:	eb da                	jmp    80152e <write+0x59>
		return -E_NOT_SUPP;
  801554:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801559:	eb d3                	jmp    80152e <write+0x59>

0080155b <seek>:

int
seek(int fdnum, off_t offset)
{
  80155b:	f3 0f 1e fb          	endbr32 
  80155f:	55                   	push   %ebp
  801560:	89 e5                	mov    %esp,%ebp
  801562:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801565:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801568:	50                   	push   %eax
  801569:	ff 75 08             	pushl  0x8(%ebp)
  80156c:	e8 0b fc ff ff       	call   80117c <fd_lookup>
  801571:	83 c4 10             	add    $0x10,%esp
  801574:	85 c0                	test   %eax,%eax
  801576:	78 0e                	js     801586 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  801578:	8b 55 0c             	mov    0xc(%ebp),%edx
  80157b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80157e:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  801581:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801586:	c9                   	leave  
  801587:	c3                   	ret    

00801588 <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  801588:	f3 0f 1e fb          	endbr32 
  80158c:	55                   	push   %ebp
  80158d:	89 e5                	mov    %esp,%ebp
  80158f:	53                   	push   %ebx
  801590:	83 ec 1c             	sub    $0x1c,%esp
  801593:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  801596:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801599:	50                   	push   %eax
  80159a:	53                   	push   %ebx
  80159b:	e8 dc fb ff ff       	call   80117c <fd_lookup>
  8015a0:	83 c4 10             	add    $0x10,%esp
  8015a3:	85 c0                	test   %eax,%eax
  8015a5:	78 37                	js     8015de <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8015a7:	83 ec 08             	sub    $0x8,%esp
  8015aa:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8015ad:	50                   	push   %eax
  8015ae:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8015b1:	ff 30                	pushl  (%eax)
  8015b3:	e8 18 fc ff ff       	call   8011d0 <dev_lookup>
  8015b8:	83 c4 10             	add    $0x10,%esp
  8015bb:	85 c0                	test   %eax,%eax
  8015bd:	78 1f                	js     8015de <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8015bf:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8015c2:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8015c6:	74 1b                	je     8015e3 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  8015c8:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8015cb:	8b 52 18             	mov    0x18(%edx),%edx
  8015ce:	85 d2                	test   %edx,%edx
  8015d0:	74 32                	je     801604 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  8015d2:	83 ec 08             	sub    $0x8,%esp
  8015d5:	ff 75 0c             	pushl  0xc(%ebp)
  8015d8:	50                   	push   %eax
  8015d9:	ff d2                	call   *%edx
  8015db:	83 c4 10             	add    $0x10,%esp
}
  8015de:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8015e1:	c9                   	leave  
  8015e2:	c3                   	ret    
			thisenv->env_id, fdnum);
  8015e3:	a1 04 44 80 00       	mov    0x804404,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  8015e8:	8b 40 48             	mov    0x48(%eax),%eax
  8015eb:	83 ec 04             	sub    $0x4,%esp
  8015ee:	53                   	push   %ebx
  8015ef:	50                   	push   %eax
  8015f0:	68 9c 25 80 00       	push   $0x80259c
  8015f5:	e8 dd ed ff ff       	call   8003d7 <cprintf>
		return -E_INVAL;
  8015fa:	83 c4 10             	add    $0x10,%esp
  8015fd:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801602:	eb da                	jmp    8015de <ftruncate+0x56>
		return -E_NOT_SUPP;
  801604:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801609:	eb d3                	jmp    8015de <ftruncate+0x56>

0080160b <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  80160b:	f3 0f 1e fb          	endbr32 
  80160f:	55                   	push   %ebp
  801610:	89 e5                	mov    %esp,%ebp
  801612:	53                   	push   %ebx
  801613:	83 ec 1c             	sub    $0x1c,%esp
  801616:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801619:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80161c:	50                   	push   %eax
  80161d:	ff 75 08             	pushl  0x8(%ebp)
  801620:	e8 57 fb ff ff       	call   80117c <fd_lookup>
  801625:	83 c4 10             	add    $0x10,%esp
  801628:	85 c0                	test   %eax,%eax
  80162a:	78 4b                	js     801677 <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80162c:	83 ec 08             	sub    $0x8,%esp
  80162f:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801632:	50                   	push   %eax
  801633:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801636:	ff 30                	pushl  (%eax)
  801638:	e8 93 fb ff ff       	call   8011d0 <dev_lookup>
  80163d:	83 c4 10             	add    $0x10,%esp
  801640:	85 c0                	test   %eax,%eax
  801642:	78 33                	js     801677 <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  801644:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801647:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  80164b:	74 2f                	je     80167c <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  80164d:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  801650:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  801657:	00 00 00 
	stat->st_isdir = 0;
  80165a:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801661:	00 00 00 
	stat->st_dev = dev;
  801664:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  80166a:	83 ec 08             	sub    $0x8,%esp
  80166d:	53                   	push   %ebx
  80166e:	ff 75 f0             	pushl  -0x10(%ebp)
  801671:	ff 50 14             	call   *0x14(%eax)
  801674:	83 c4 10             	add    $0x10,%esp
}
  801677:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80167a:	c9                   	leave  
  80167b:	c3                   	ret    
		return -E_NOT_SUPP;
  80167c:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801681:	eb f4                	jmp    801677 <fstat+0x6c>

00801683 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  801683:	f3 0f 1e fb          	endbr32 
  801687:	55                   	push   %ebp
  801688:	89 e5                	mov    %esp,%ebp
  80168a:	56                   	push   %esi
  80168b:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  80168c:	83 ec 08             	sub    $0x8,%esp
  80168f:	6a 00                	push   $0x0
  801691:	ff 75 08             	pushl  0x8(%ebp)
  801694:	e8 fb 01 00 00       	call   801894 <open>
  801699:	89 c3                	mov    %eax,%ebx
  80169b:	83 c4 10             	add    $0x10,%esp
  80169e:	85 c0                	test   %eax,%eax
  8016a0:	78 1b                	js     8016bd <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  8016a2:	83 ec 08             	sub    $0x8,%esp
  8016a5:	ff 75 0c             	pushl  0xc(%ebp)
  8016a8:	50                   	push   %eax
  8016a9:	e8 5d ff ff ff       	call   80160b <fstat>
  8016ae:	89 c6                	mov    %eax,%esi
	close(fd);
  8016b0:	89 1c 24             	mov    %ebx,(%esp)
  8016b3:	e8 fd fb ff ff       	call   8012b5 <close>
	return r;
  8016b8:	83 c4 10             	add    $0x10,%esp
  8016bb:	89 f3                	mov    %esi,%ebx
}
  8016bd:	89 d8                	mov    %ebx,%eax
  8016bf:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8016c2:	5b                   	pop    %ebx
  8016c3:	5e                   	pop    %esi
  8016c4:	5d                   	pop    %ebp
  8016c5:	c3                   	ret    

008016c6 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  8016c6:	55                   	push   %ebp
  8016c7:	89 e5                	mov    %esp,%ebp
  8016c9:	56                   	push   %esi
  8016ca:	53                   	push   %ebx
  8016cb:	89 c6                	mov    %eax,%esi
  8016cd:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  8016cf:	83 3d 00 44 80 00 00 	cmpl   $0x0,0x804400
  8016d6:	74 27                	je     8016ff <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  8016d8:	6a 07                	push   $0x7
  8016da:	68 00 50 80 00       	push   $0x805000
  8016df:	56                   	push   %esi
  8016e0:	ff 35 00 44 80 00    	pushl  0x804400
  8016e6:	e8 61 07 00 00       	call   801e4c <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  8016eb:	83 c4 0c             	add    $0xc,%esp
  8016ee:	6a 00                	push   $0x0
  8016f0:	53                   	push   %ebx
  8016f1:	6a 00                	push   $0x0
  8016f3:	e8 d3 06 00 00       	call   801dcb <ipc_recv>
}
  8016f8:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8016fb:	5b                   	pop    %ebx
  8016fc:	5e                   	pop    %esi
  8016fd:	5d                   	pop    %ebp
  8016fe:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  8016ff:	83 ec 0c             	sub    $0xc,%esp
  801702:	6a 01                	push   $0x1
  801704:	e8 9b 07 00 00       	call   801ea4 <ipc_find_env>
  801709:	a3 00 44 80 00       	mov    %eax,0x804400
  80170e:	83 c4 10             	add    $0x10,%esp
  801711:	eb c5                	jmp    8016d8 <fsipc+0x12>

00801713 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  801713:	f3 0f 1e fb          	endbr32 
  801717:	55                   	push   %ebp
  801718:	89 e5                	mov    %esp,%ebp
  80171a:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  80171d:	8b 45 08             	mov    0x8(%ebp),%eax
  801720:	8b 40 0c             	mov    0xc(%eax),%eax
  801723:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  801728:	8b 45 0c             	mov    0xc(%ebp),%eax
  80172b:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  801730:	ba 00 00 00 00       	mov    $0x0,%edx
  801735:	b8 02 00 00 00       	mov    $0x2,%eax
  80173a:	e8 87 ff ff ff       	call   8016c6 <fsipc>
}
  80173f:	c9                   	leave  
  801740:	c3                   	ret    

00801741 <devfile_flush>:
{
  801741:	f3 0f 1e fb          	endbr32 
  801745:	55                   	push   %ebp
  801746:	89 e5                	mov    %esp,%ebp
  801748:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  80174b:	8b 45 08             	mov    0x8(%ebp),%eax
  80174e:	8b 40 0c             	mov    0xc(%eax),%eax
  801751:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  801756:	ba 00 00 00 00       	mov    $0x0,%edx
  80175b:	b8 06 00 00 00       	mov    $0x6,%eax
  801760:	e8 61 ff ff ff       	call   8016c6 <fsipc>
}
  801765:	c9                   	leave  
  801766:	c3                   	ret    

00801767 <devfile_stat>:
{
  801767:	f3 0f 1e fb          	endbr32 
  80176b:	55                   	push   %ebp
  80176c:	89 e5                	mov    %esp,%ebp
  80176e:	53                   	push   %ebx
  80176f:	83 ec 04             	sub    $0x4,%esp
  801772:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  801775:	8b 45 08             	mov    0x8(%ebp),%eax
  801778:	8b 40 0c             	mov    0xc(%eax),%eax
  80177b:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  801780:	ba 00 00 00 00       	mov    $0x0,%edx
  801785:	b8 05 00 00 00       	mov    $0x5,%eax
  80178a:	e8 37 ff ff ff       	call   8016c6 <fsipc>
  80178f:	85 c0                	test   %eax,%eax
  801791:	78 2c                	js     8017bf <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  801793:	83 ec 08             	sub    $0x8,%esp
  801796:	68 00 50 80 00       	push   $0x805000
  80179b:	53                   	push   %ebx
  80179c:	e8 03 f3 ff ff       	call   800aa4 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  8017a1:	a1 80 50 80 00       	mov    0x805080,%eax
  8017a6:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  8017ac:	a1 84 50 80 00       	mov    0x805084,%eax
  8017b1:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  8017b7:	83 c4 10             	add    $0x10,%esp
  8017ba:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8017bf:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8017c2:	c9                   	leave  
  8017c3:	c3                   	ret    

008017c4 <devfile_write>:
{
  8017c4:	f3 0f 1e fb          	endbr32 
  8017c8:	55                   	push   %ebp
  8017c9:	89 e5                	mov    %esp,%ebp
  8017cb:	83 ec 0c             	sub    $0xc,%esp
  8017ce:	8b 45 10             	mov    0x10(%ebp),%eax
  8017d1:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  8017d6:	ba f8 0f 00 00       	mov    $0xff8,%edx
  8017db:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  8017de:	8b 55 08             	mov    0x8(%ebp),%edx
  8017e1:	8b 52 0c             	mov    0xc(%edx),%edx
  8017e4:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  8017ea:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  8017ef:	50                   	push   %eax
  8017f0:	ff 75 0c             	pushl  0xc(%ebp)
  8017f3:	68 08 50 80 00       	push   $0x805008
  8017f8:	e8 5d f4 ff ff       	call   800c5a <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  8017fd:	ba 00 00 00 00       	mov    $0x0,%edx
  801802:	b8 04 00 00 00       	mov    $0x4,%eax
  801807:	e8 ba fe ff ff       	call   8016c6 <fsipc>
  80180c:	c9                   	leave  
  80180d:	c3                   	ret    

0080180e <devfile_read>:
{
  80180e:	f3 0f 1e fb          	endbr32 
  801812:	55                   	push   %ebp
  801813:	89 e5                	mov    %esp,%ebp
  801815:	56                   	push   %esi
  801816:	53                   	push   %ebx
  801817:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  80181a:	8b 45 08             	mov    0x8(%ebp),%eax
  80181d:	8b 40 0c             	mov    0xc(%eax),%eax
  801820:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801825:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  80182b:	ba 00 00 00 00       	mov    $0x0,%edx
  801830:	b8 03 00 00 00       	mov    $0x3,%eax
  801835:	e8 8c fe ff ff       	call   8016c6 <fsipc>
  80183a:	89 c3                	mov    %eax,%ebx
  80183c:	85 c0                	test   %eax,%eax
  80183e:	78 1f                	js     80185f <devfile_read+0x51>
	assert(r <= n);
  801840:	39 f0                	cmp    %esi,%eax
  801842:	77 24                	ja     801868 <devfile_read+0x5a>
	assert(r <= PGSIZE);
  801844:	3d 00 10 00 00       	cmp    $0x1000,%eax
  801849:	7f 33                	jg     80187e <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  80184b:	83 ec 04             	sub    $0x4,%esp
  80184e:	50                   	push   %eax
  80184f:	68 00 50 80 00       	push   $0x805000
  801854:	ff 75 0c             	pushl  0xc(%ebp)
  801857:	e8 fe f3 ff ff       	call   800c5a <memmove>
	return r;
  80185c:	83 c4 10             	add    $0x10,%esp
}
  80185f:	89 d8                	mov    %ebx,%eax
  801861:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801864:	5b                   	pop    %ebx
  801865:	5e                   	pop    %esi
  801866:	5d                   	pop    %ebp
  801867:	c3                   	ret    
	assert(r <= n);
  801868:	68 08 26 80 00       	push   $0x802608
  80186d:	68 0f 26 80 00       	push   $0x80260f
  801872:	6a 7c                	push   $0x7c
  801874:	68 24 26 80 00       	push   $0x802624
  801879:	e8 72 ea ff ff       	call   8002f0 <_panic>
	assert(r <= PGSIZE);
  80187e:	68 2f 26 80 00       	push   $0x80262f
  801883:	68 0f 26 80 00       	push   $0x80260f
  801888:	6a 7d                	push   $0x7d
  80188a:	68 24 26 80 00       	push   $0x802624
  80188f:	e8 5c ea ff ff       	call   8002f0 <_panic>

00801894 <open>:
{
  801894:	f3 0f 1e fb          	endbr32 
  801898:	55                   	push   %ebp
  801899:	89 e5                	mov    %esp,%ebp
  80189b:	56                   	push   %esi
  80189c:	53                   	push   %ebx
  80189d:	83 ec 1c             	sub    $0x1c,%esp
  8018a0:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  8018a3:	56                   	push   %esi
  8018a4:	e8 b8 f1 ff ff       	call   800a61 <strlen>
  8018a9:	83 c4 10             	add    $0x10,%esp
  8018ac:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  8018b1:	7f 6c                	jg     80191f <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  8018b3:	83 ec 0c             	sub    $0xc,%esp
  8018b6:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8018b9:	50                   	push   %eax
  8018ba:	e8 67 f8 ff ff       	call   801126 <fd_alloc>
  8018bf:	89 c3                	mov    %eax,%ebx
  8018c1:	83 c4 10             	add    $0x10,%esp
  8018c4:	85 c0                	test   %eax,%eax
  8018c6:	78 3c                	js     801904 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  8018c8:	83 ec 08             	sub    $0x8,%esp
  8018cb:	56                   	push   %esi
  8018cc:	68 00 50 80 00       	push   $0x805000
  8018d1:	e8 ce f1 ff ff       	call   800aa4 <strcpy>
	fsipcbuf.open.req_omode = mode;
  8018d6:	8b 45 0c             	mov    0xc(%ebp),%eax
  8018d9:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  8018de:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8018e1:	b8 01 00 00 00       	mov    $0x1,%eax
  8018e6:	e8 db fd ff ff       	call   8016c6 <fsipc>
  8018eb:	89 c3                	mov    %eax,%ebx
  8018ed:	83 c4 10             	add    $0x10,%esp
  8018f0:	85 c0                	test   %eax,%eax
  8018f2:	78 19                	js     80190d <open+0x79>
	return fd2num(fd);
  8018f4:	83 ec 0c             	sub    $0xc,%esp
  8018f7:	ff 75 f4             	pushl  -0xc(%ebp)
  8018fa:	e8 f8 f7 ff ff       	call   8010f7 <fd2num>
  8018ff:	89 c3                	mov    %eax,%ebx
  801901:	83 c4 10             	add    $0x10,%esp
}
  801904:	89 d8                	mov    %ebx,%eax
  801906:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801909:	5b                   	pop    %ebx
  80190a:	5e                   	pop    %esi
  80190b:	5d                   	pop    %ebp
  80190c:	c3                   	ret    
		fd_close(fd, 0);
  80190d:	83 ec 08             	sub    $0x8,%esp
  801910:	6a 00                	push   $0x0
  801912:	ff 75 f4             	pushl  -0xc(%ebp)
  801915:	e8 10 f9 ff ff       	call   80122a <fd_close>
		return r;
  80191a:	83 c4 10             	add    $0x10,%esp
  80191d:	eb e5                	jmp    801904 <open+0x70>
		return -E_BAD_PATH;
  80191f:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801924:	eb de                	jmp    801904 <open+0x70>

00801926 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801926:	f3 0f 1e fb          	endbr32 
  80192a:	55                   	push   %ebp
  80192b:	89 e5                	mov    %esp,%ebp
  80192d:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  801930:	ba 00 00 00 00       	mov    $0x0,%edx
  801935:	b8 08 00 00 00       	mov    $0x8,%eax
  80193a:	e8 87 fd ff ff       	call   8016c6 <fsipc>
}
  80193f:	c9                   	leave  
  801940:	c3                   	ret    

00801941 <writebuf>:


static void
writebuf(struct printbuf *b)
{
	if (b->error > 0) {
  801941:	83 78 0c 00          	cmpl   $0x0,0xc(%eax)
  801945:	7f 01                	jg     801948 <writebuf+0x7>
  801947:	c3                   	ret    
{
  801948:	55                   	push   %ebp
  801949:	89 e5                	mov    %esp,%ebp
  80194b:	53                   	push   %ebx
  80194c:	83 ec 08             	sub    $0x8,%esp
  80194f:	89 c3                	mov    %eax,%ebx
		ssize_t result = write(b->fd, b->buf, b->idx);
  801951:	ff 70 04             	pushl  0x4(%eax)
  801954:	8d 40 10             	lea    0x10(%eax),%eax
  801957:	50                   	push   %eax
  801958:	ff 33                	pushl  (%ebx)
  80195a:	e8 76 fb ff ff       	call   8014d5 <write>
		if (result > 0)
  80195f:	83 c4 10             	add    $0x10,%esp
  801962:	85 c0                	test   %eax,%eax
  801964:	7e 03                	jle    801969 <writebuf+0x28>
			b->result += result;
  801966:	01 43 08             	add    %eax,0x8(%ebx)
		if (result != b->idx) // error, or wrote less than supplied
  801969:	39 43 04             	cmp    %eax,0x4(%ebx)
  80196c:	74 0d                	je     80197b <writebuf+0x3a>
			b->error = (result < 0 ? result : 0);
  80196e:	85 c0                	test   %eax,%eax
  801970:	ba 00 00 00 00       	mov    $0x0,%edx
  801975:	0f 4f c2             	cmovg  %edx,%eax
  801978:	89 43 0c             	mov    %eax,0xc(%ebx)
	}
}
  80197b:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80197e:	c9                   	leave  
  80197f:	c3                   	ret    

00801980 <putch>:

static void
putch(int ch, void *thunk)
{
  801980:	f3 0f 1e fb          	endbr32 
  801984:	55                   	push   %ebp
  801985:	89 e5                	mov    %esp,%ebp
  801987:	53                   	push   %ebx
  801988:	83 ec 04             	sub    $0x4,%esp
  80198b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct printbuf *b = (struct printbuf *) thunk;
	b->buf[b->idx++] = ch;
  80198e:	8b 53 04             	mov    0x4(%ebx),%edx
  801991:	8d 42 01             	lea    0x1(%edx),%eax
  801994:	89 43 04             	mov    %eax,0x4(%ebx)
  801997:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80199a:	88 4c 13 10          	mov    %cl,0x10(%ebx,%edx,1)
	if (b->idx == 256) {
  80199e:	3d 00 01 00 00       	cmp    $0x100,%eax
  8019a3:	74 06                	je     8019ab <putch+0x2b>
		writebuf(b);
		b->idx = 0;
	}
}
  8019a5:	83 c4 04             	add    $0x4,%esp
  8019a8:	5b                   	pop    %ebx
  8019a9:	5d                   	pop    %ebp
  8019aa:	c3                   	ret    
		writebuf(b);
  8019ab:	89 d8                	mov    %ebx,%eax
  8019ad:	e8 8f ff ff ff       	call   801941 <writebuf>
		b->idx = 0;
  8019b2:	c7 43 04 00 00 00 00 	movl   $0x0,0x4(%ebx)
}
  8019b9:	eb ea                	jmp    8019a5 <putch+0x25>

008019bb <vfprintf>:

int
vfprintf(int fd, const char *fmt, va_list ap)
{
  8019bb:	f3 0f 1e fb          	endbr32 
  8019bf:	55                   	push   %ebp
  8019c0:	89 e5                	mov    %esp,%ebp
  8019c2:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.fd = fd;
  8019c8:	8b 45 08             	mov    0x8(%ebp),%eax
  8019cb:	89 85 e8 fe ff ff    	mov    %eax,-0x118(%ebp)
	b.idx = 0;
  8019d1:	c7 85 ec fe ff ff 00 	movl   $0x0,-0x114(%ebp)
  8019d8:	00 00 00 
	b.result = 0;
  8019db:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8019e2:	00 00 00 
	b.error = 1;
  8019e5:	c7 85 f4 fe ff ff 01 	movl   $0x1,-0x10c(%ebp)
  8019ec:	00 00 00 
	vprintfmt(putch, &b, fmt, ap);
  8019ef:	ff 75 10             	pushl  0x10(%ebp)
  8019f2:	ff 75 0c             	pushl  0xc(%ebp)
  8019f5:	8d 85 e8 fe ff ff    	lea    -0x118(%ebp),%eax
  8019fb:	50                   	push   %eax
  8019fc:	68 80 19 80 00       	push   $0x801980
  801a01:	e8 d4 ea ff ff       	call   8004da <vprintfmt>
	if (b.idx > 0)
  801a06:	83 c4 10             	add    $0x10,%esp
  801a09:	83 bd ec fe ff ff 00 	cmpl   $0x0,-0x114(%ebp)
  801a10:	7f 11                	jg     801a23 <vfprintf+0x68>
		writebuf(&b);

	return (b.result ? b.result : b.error);
  801a12:	8b 85 f0 fe ff ff    	mov    -0x110(%ebp),%eax
  801a18:	85 c0                	test   %eax,%eax
  801a1a:	0f 44 85 f4 fe ff ff 	cmove  -0x10c(%ebp),%eax
}
  801a21:	c9                   	leave  
  801a22:	c3                   	ret    
		writebuf(&b);
  801a23:	8d 85 e8 fe ff ff    	lea    -0x118(%ebp),%eax
  801a29:	e8 13 ff ff ff       	call   801941 <writebuf>
  801a2e:	eb e2                	jmp    801a12 <vfprintf+0x57>

00801a30 <fprintf>:

int
fprintf(int fd, const char *fmt, ...)
{
  801a30:	f3 0f 1e fb          	endbr32 
  801a34:	55                   	push   %ebp
  801a35:	89 e5                	mov    %esp,%ebp
  801a37:	83 ec 0c             	sub    $0xc,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  801a3a:	8d 45 10             	lea    0x10(%ebp),%eax
	cnt = vfprintf(fd, fmt, ap);
  801a3d:	50                   	push   %eax
  801a3e:	ff 75 0c             	pushl  0xc(%ebp)
  801a41:	ff 75 08             	pushl  0x8(%ebp)
  801a44:	e8 72 ff ff ff       	call   8019bb <vfprintf>
	va_end(ap);

	return cnt;
}
  801a49:	c9                   	leave  
  801a4a:	c3                   	ret    

00801a4b <printf>:

int
printf(const char *fmt, ...)
{
  801a4b:	f3 0f 1e fb          	endbr32 
  801a4f:	55                   	push   %ebp
  801a50:	89 e5                	mov    %esp,%ebp
  801a52:	83 ec 0c             	sub    $0xc,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  801a55:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vfprintf(1, fmt, ap);
  801a58:	50                   	push   %eax
  801a59:	ff 75 08             	pushl  0x8(%ebp)
  801a5c:	6a 01                	push   $0x1
  801a5e:	e8 58 ff ff ff       	call   8019bb <vfprintf>
	va_end(ap);

	return cnt;
}
  801a63:	c9                   	leave  
  801a64:	c3                   	ret    

00801a65 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801a65:	f3 0f 1e fb          	endbr32 
  801a69:	55                   	push   %ebp
  801a6a:	89 e5                	mov    %esp,%ebp
  801a6c:	56                   	push   %esi
  801a6d:	53                   	push   %ebx
  801a6e:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801a71:	83 ec 0c             	sub    $0xc,%esp
  801a74:	ff 75 08             	pushl  0x8(%ebp)
  801a77:	e8 8f f6 ff ff       	call   80110b <fd2data>
  801a7c:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801a7e:	83 c4 08             	add    $0x8,%esp
  801a81:	68 3b 26 80 00       	push   $0x80263b
  801a86:	53                   	push   %ebx
  801a87:	e8 18 f0 ff ff       	call   800aa4 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801a8c:	8b 46 04             	mov    0x4(%esi),%eax
  801a8f:	2b 06                	sub    (%esi),%eax
  801a91:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801a97:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801a9e:	00 00 00 
	stat->st_dev = &devpipe;
  801aa1:	c7 83 88 00 00 00 3c 	movl   $0x80303c,0x88(%ebx)
  801aa8:	30 80 00 
	return 0;
}
  801aab:	b8 00 00 00 00       	mov    $0x0,%eax
  801ab0:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801ab3:	5b                   	pop    %ebx
  801ab4:	5e                   	pop    %esi
  801ab5:	5d                   	pop    %ebp
  801ab6:	c3                   	ret    

00801ab7 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801ab7:	f3 0f 1e fb          	endbr32 
  801abb:	55                   	push   %ebp
  801abc:	89 e5                	mov    %esp,%ebp
  801abe:	53                   	push   %ebx
  801abf:	83 ec 0c             	sub    $0xc,%esp
  801ac2:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801ac5:	53                   	push   %ebx
  801ac6:	6a 00                	push   $0x0
  801ac8:	e8 a6 f4 ff ff       	call   800f73 <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801acd:	89 1c 24             	mov    %ebx,(%esp)
  801ad0:	e8 36 f6 ff ff       	call   80110b <fd2data>
  801ad5:	83 c4 08             	add    $0x8,%esp
  801ad8:	50                   	push   %eax
  801ad9:	6a 00                	push   $0x0
  801adb:	e8 93 f4 ff ff       	call   800f73 <sys_page_unmap>
}
  801ae0:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801ae3:	c9                   	leave  
  801ae4:	c3                   	ret    

00801ae5 <_pipeisclosed>:
{
  801ae5:	55                   	push   %ebp
  801ae6:	89 e5                	mov    %esp,%ebp
  801ae8:	57                   	push   %edi
  801ae9:	56                   	push   %esi
  801aea:	53                   	push   %ebx
  801aeb:	83 ec 1c             	sub    $0x1c,%esp
  801aee:	89 c7                	mov    %eax,%edi
  801af0:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801af2:	a1 04 44 80 00       	mov    0x804404,%eax
  801af7:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801afa:	83 ec 0c             	sub    $0xc,%esp
  801afd:	57                   	push   %edi
  801afe:	e8 de 03 00 00       	call   801ee1 <pageref>
  801b03:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801b06:	89 34 24             	mov    %esi,(%esp)
  801b09:	e8 d3 03 00 00       	call   801ee1 <pageref>
		nn = thisenv->env_runs;
  801b0e:	8b 15 04 44 80 00    	mov    0x804404,%edx
  801b14:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801b17:	83 c4 10             	add    $0x10,%esp
  801b1a:	39 cb                	cmp    %ecx,%ebx
  801b1c:	74 1b                	je     801b39 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801b1e:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801b21:	75 cf                	jne    801af2 <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801b23:	8b 42 58             	mov    0x58(%edx),%eax
  801b26:	6a 01                	push   $0x1
  801b28:	50                   	push   %eax
  801b29:	53                   	push   %ebx
  801b2a:	68 42 26 80 00       	push   $0x802642
  801b2f:	e8 a3 e8 ff ff       	call   8003d7 <cprintf>
  801b34:	83 c4 10             	add    $0x10,%esp
  801b37:	eb b9                	jmp    801af2 <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801b39:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801b3c:	0f 94 c0             	sete   %al
  801b3f:	0f b6 c0             	movzbl %al,%eax
}
  801b42:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801b45:	5b                   	pop    %ebx
  801b46:	5e                   	pop    %esi
  801b47:	5f                   	pop    %edi
  801b48:	5d                   	pop    %ebp
  801b49:	c3                   	ret    

00801b4a <devpipe_write>:
{
  801b4a:	f3 0f 1e fb          	endbr32 
  801b4e:	55                   	push   %ebp
  801b4f:	89 e5                	mov    %esp,%ebp
  801b51:	57                   	push   %edi
  801b52:	56                   	push   %esi
  801b53:	53                   	push   %ebx
  801b54:	83 ec 28             	sub    $0x28,%esp
  801b57:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801b5a:	56                   	push   %esi
  801b5b:	e8 ab f5 ff ff       	call   80110b <fd2data>
  801b60:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801b62:	83 c4 10             	add    $0x10,%esp
  801b65:	bf 00 00 00 00       	mov    $0x0,%edi
  801b6a:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801b6d:	74 4f                	je     801bbe <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801b6f:	8b 43 04             	mov    0x4(%ebx),%eax
  801b72:	8b 0b                	mov    (%ebx),%ecx
  801b74:	8d 51 20             	lea    0x20(%ecx),%edx
  801b77:	39 d0                	cmp    %edx,%eax
  801b79:	72 14                	jb     801b8f <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801b7b:	89 da                	mov    %ebx,%edx
  801b7d:	89 f0                	mov    %esi,%eax
  801b7f:	e8 61 ff ff ff       	call   801ae5 <_pipeisclosed>
  801b84:	85 c0                	test   %eax,%eax
  801b86:	75 3b                	jne    801bc3 <devpipe_write+0x79>
			sys_yield();
  801b88:	e8 36 f3 ff ff       	call   800ec3 <sys_yield>
  801b8d:	eb e0                	jmp    801b6f <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801b8f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801b92:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801b96:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801b99:	89 c2                	mov    %eax,%edx
  801b9b:	c1 fa 1f             	sar    $0x1f,%edx
  801b9e:	89 d1                	mov    %edx,%ecx
  801ba0:	c1 e9 1b             	shr    $0x1b,%ecx
  801ba3:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801ba6:	83 e2 1f             	and    $0x1f,%edx
  801ba9:	29 ca                	sub    %ecx,%edx
  801bab:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801baf:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801bb3:	83 c0 01             	add    $0x1,%eax
  801bb6:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801bb9:	83 c7 01             	add    $0x1,%edi
  801bbc:	eb ac                	jmp    801b6a <devpipe_write+0x20>
	return i;
  801bbe:	8b 45 10             	mov    0x10(%ebp),%eax
  801bc1:	eb 05                	jmp    801bc8 <devpipe_write+0x7e>
				return 0;
  801bc3:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801bc8:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801bcb:	5b                   	pop    %ebx
  801bcc:	5e                   	pop    %esi
  801bcd:	5f                   	pop    %edi
  801bce:	5d                   	pop    %ebp
  801bcf:	c3                   	ret    

00801bd0 <devpipe_read>:
{
  801bd0:	f3 0f 1e fb          	endbr32 
  801bd4:	55                   	push   %ebp
  801bd5:	89 e5                	mov    %esp,%ebp
  801bd7:	57                   	push   %edi
  801bd8:	56                   	push   %esi
  801bd9:	53                   	push   %ebx
  801bda:	83 ec 18             	sub    $0x18,%esp
  801bdd:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801be0:	57                   	push   %edi
  801be1:	e8 25 f5 ff ff       	call   80110b <fd2data>
  801be6:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801be8:	83 c4 10             	add    $0x10,%esp
  801beb:	be 00 00 00 00       	mov    $0x0,%esi
  801bf0:	3b 75 10             	cmp    0x10(%ebp),%esi
  801bf3:	75 14                	jne    801c09 <devpipe_read+0x39>
	return i;
  801bf5:	8b 45 10             	mov    0x10(%ebp),%eax
  801bf8:	eb 02                	jmp    801bfc <devpipe_read+0x2c>
				return i;
  801bfa:	89 f0                	mov    %esi,%eax
}
  801bfc:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801bff:	5b                   	pop    %ebx
  801c00:	5e                   	pop    %esi
  801c01:	5f                   	pop    %edi
  801c02:	5d                   	pop    %ebp
  801c03:	c3                   	ret    
			sys_yield();
  801c04:	e8 ba f2 ff ff       	call   800ec3 <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801c09:	8b 03                	mov    (%ebx),%eax
  801c0b:	3b 43 04             	cmp    0x4(%ebx),%eax
  801c0e:	75 18                	jne    801c28 <devpipe_read+0x58>
			if (i > 0)
  801c10:	85 f6                	test   %esi,%esi
  801c12:	75 e6                	jne    801bfa <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801c14:	89 da                	mov    %ebx,%edx
  801c16:	89 f8                	mov    %edi,%eax
  801c18:	e8 c8 fe ff ff       	call   801ae5 <_pipeisclosed>
  801c1d:	85 c0                	test   %eax,%eax
  801c1f:	74 e3                	je     801c04 <devpipe_read+0x34>
				return 0;
  801c21:	b8 00 00 00 00       	mov    $0x0,%eax
  801c26:	eb d4                	jmp    801bfc <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801c28:	99                   	cltd   
  801c29:	c1 ea 1b             	shr    $0x1b,%edx
  801c2c:	01 d0                	add    %edx,%eax
  801c2e:	83 e0 1f             	and    $0x1f,%eax
  801c31:	29 d0                	sub    %edx,%eax
  801c33:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801c38:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801c3b:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801c3e:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801c41:	83 c6 01             	add    $0x1,%esi
  801c44:	eb aa                	jmp    801bf0 <devpipe_read+0x20>

00801c46 <pipe>:
{
  801c46:	f3 0f 1e fb          	endbr32 
  801c4a:	55                   	push   %ebp
  801c4b:	89 e5                	mov    %esp,%ebp
  801c4d:	56                   	push   %esi
  801c4e:	53                   	push   %ebx
  801c4f:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801c52:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801c55:	50                   	push   %eax
  801c56:	e8 cb f4 ff ff       	call   801126 <fd_alloc>
  801c5b:	89 c3                	mov    %eax,%ebx
  801c5d:	83 c4 10             	add    $0x10,%esp
  801c60:	85 c0                	test   %eax,%eax
  801c62:	0f 88 23 01 00 00    	js     801d8b <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801c68:	83 ec 04             	sub    $0x4,%esp
  801c6b:	68 07 04 00 00       	push   $0x407
  801c70:	ff 75 f4             	pushl  -0xc(%ebp)
  801c73:	6a 00                	push   $0x0
  801c75:	e8 6c f2 ff ff       	call   800ee6 <sys_page_alloc>
  801c7a:	89 c3                	mov    %eax,%ebx
  801c7c:	83 c4 10             	add    $0x10,%esp
  801c7f:	85 c0                	test   %eax,%eax
  801c81:	0f 88 04 01 00 00    	js     801d8b <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801c87:	83 ec 0c             	sub    $0xc,%esp
  801c8a:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801c8d:	50                   	push   %eax
  801c8e:	e8 93 f4 ff ff       	call   801126 <fd_alloc>
  801c93:	89 c3                	mov    %eax,%ebx
  801c95:	83 c4 10             	add    $0x10,%esp
  801c98:	85 c0                	test   %eax,%eax
  801c9a:	0f 88 db 00 00 00    	js     801d7b <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ca0:	83 ec 04             	sub    $0x4,%esp
  801ca3:	68 07 04 00 00       	push   $0x407
  801ca8:	ff 75 f0             	pushl  -0x10(%ebp)
  801cab:	6a 00                	push   $0x0
  801cad:	e8 34 f2 ff ff       	call   800ee6 <sys_page_alloc>
  801cb2:	89 c3                	mov    %eax,%ebx
  801cb4:	83 c4 10             	add    $0x10,%esp
  801cb7:	85 c0                	test   %eax,%eax
  801cb9:	0f 88 bc 00 00 00    	js     801d7b <pipe+0x135>
	va = fd2data(fd0);
  801cbf:	83 ec 0c             	sub    $0xc,%esp
  801cc2:	ff 75 f4             	pushl  -0xc(%ebp)
  801cc5:	e8 41 f4 ff ff       	call   80110b <fd2data>
  801cca:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ccc:	83 c4 0c             	add    $0xc,%esp
  801ccf:	68 07 04 00 00       	push   $0x407
  801cd4:	50                   	push   %eax
  801cd5:	6a 00                	push   $0x0
  801cd7:	e8 0a f2 ff ff       	call   800ee6 <sys_page_alloc>
  801cdc:	89 c3                	mov    %eax,%ebx
  801cde:	83 c4 10             	add    $0x10,%esp
  801ce1:	85 c0                	test   %eax,%eax
  801ce3:	0f 88 82 00 00 00    	js     801d6b <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ce9:	83 ec 0c             	sub    $0xc,%esp
  801cec:	ff 75 f0             	pushl  -0x10(%ebp)
  801cef:	e8 17 f4 ff ff       	call   80110b <fd2data>
  801cf4:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801cfb:	50                   	push   %eax
  801cfc:	6a 00                	push   $0x0
  801cfe:	56                   	push   %esi
  801cff:	6a 00                	push   $0x0
  801d01:	e8 27 f2 ff ff       	call   800f2d <sys_page_map>
  801d06:	89 c3                	mov    %eax,%ebx
  801d08:	83 c4 20             	add    $0x20,%esp
  801d0b:	85 c0                	test   %eax,%eax
  801d0d:	78 4e                	js     801d5d <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801d0f:	a1 3c 30 80 00       	mov    0x80303c,%eax
  801d14:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801d17:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801d19:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801d1c:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801d23:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801d26:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801d28:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801d2b:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801d32:	83 ec 0c             	sub    $0xc,%esp
  801d35:	ff 75 f4             	pushl  -0xc(%ebp)
  801d38:	e8 ba f3 ff ff       	call   8010f7 <fd2num>
  801d3d:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801d40:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801d42:	83 c4 04             	add    $0x4,%esp
  801d45:	ff 75 f0             	pushl  -0x10(%ebp)
  801d48:	e8 aa f3 ff ff       	call   8010f7 <fd2num>
  801d4d:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801d50:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801d53:	83 c4 10             	add    $0x10,%esp
  801d56:	bb 00 00 00 00       	mov    $0x0,%ebx
  801d5b:	eb 2e                	jmp    801d8b <pipe+0x145>
	sys_page_unmap(0, va);
  801d5d:	83 ec 08             	sub    $0x8,%esp
  801d60:	56                   	push   %esi
  801d61:	6a 00                	push   $0x0
  801d63:	e8 0b f2 ff ff       	call   800f73 <sys_page_unmap>
  801d68:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801d6b:	83 ec 08             	sub    $0x8,%esp
  801d6e:	ff 75 f0             	pushl  -0x10(%ebp)
  801d71:	6a 00                	push   $0x0
  801d73:	e8 fb f1 ff ff       	call   800f73 <sys_page_unmap>
  801d78:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801d7b:	83 ec 08             	sub    $0x8,%esp
  801d7e:	ff 75 f4             	pushl  -0xc(%ebp)
  801d81:	6a 00                	push   $0x0
  801d83:	e8 eb f1 ff ff       	call   800f73 <sys_page_unmap>
  801d88:	83 c4 10             	add    $0x10,%esp
}
  801d8b:	89 d8                	mov    %ebx,%eax
  801d8d:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801d90:	5b                   	pop    %ebx
  801d91:	5e                   	pop    %esi
  801d92:	5d                   	pop    %ebp
  801d93:	c3                   	ret    

00801d94 <pipeisclosed>:
{
  801d94:	f3 0f 1e fb          	endbr32 
  801d98:	55                   	push   %ebp
  801d99:	89 e5                	mov    %esp,%ebp
  801d9b:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801d9e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801da1:	50                   	push   %eax
  801da2:	ff 75 08             	pushl  0x8(%ebp)
  801da5:	e8 d2 f3 ff ff       	call   80117c <fd_lookup>
  801daa:	83 c4 10             	add    $0x10,%esp
  801dad:	85 c0                	test   %eax,%eax
  801daf:	78 18                	js     801dc9 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801db1:	83 ec 0c             	sub    $0xc,%esp
  801db4:	ff 75 f4             	pushl  -0xc(%ebp)
  801db7:	e8 4f f3 ff ff       	call   80110b <fd2data>
  801dbc:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801dbe:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801dc1:	e8 1f fd ff ff       	call   801ae5 <_pipeisclosed>
  801dc6:	83 c4 10             	add    $0x10,%esp
}
  801dc9:	c9                   	leave  
  801dca:	c3                   	ret    

00801dcb <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  801dcb:	f3 0f 1e fb          	endbr32 
  801dcf:	55                   	push   %ebp
  801dd0:	89 e5                	mov    %esp,%ebp
  801dd2:	56                   	push   %esi
  801dd3:	53                   	push   %ebx
  801dd4:	8b 75 08             	mov    0x8(%ebp),%esi
  801dd7:	8b 45 0c             	mov    0xc(%ebp),%eax
  801dda:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801ddd:	85 c0                	test   %eax,%eax
  801ddf:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  801de4:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  801de7:	83 ec 0c             	sub    $0xc,%esp
  801dea:	50                   	push   %eax
  801deb:	e8 c2 f2 ff ff       	call   8010b2 <sys_ipc_recv>
  801df0:	83 c4 10             	add    $0x10,%esp
  801df3:	85 c0                	test   %eax,%eax
  801df5:	78 3f                	js     801e36 <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  801df7:	e8 a4 f0 ff ff       	call   800ea0 <sys_getenvid>
  801dfc:	25 ff 03 00 00       	and    $0x3ff,%eax
  801e01:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801e04:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801e0a:	89 15 04 44 80 00    	mov    %edx,0x804404

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801e10:	85 f6                	test   %esi,%esi
  801e12:	74 05                	je     801e19 <ipc_recv+0x4e>
  801e14:	8b 42 74             	mov    0x74(%edx),%eax
  801e17:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  801e19:	85 db                	test   %ebx,%ebx
  801e1b:	74 0a                	je     801e27 <ipc_recv+0x5c>
  801e1d:	a1 04 44 80 00       	mov    0x804404,%eax
  801e22:	8b 40 78             	mov    0x78(%eax),%eax
  801e25:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  801e27:	a1 04 44 80 00       	mov    0x804404,%eax
  801e2c:	8b 40 70             	mov    0x70(%eax),%eax
}
  801e2f:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801e32:	5b                   	pop    %ebx
  801e33:	5e                   	pop    %esi
  801e34:	5d                   	pop    %ebp
  801e35:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  801e36:	85 f6                	test   %esi,%esi
  801e38:	74 06                	je     801e40 <ipc_recv+0x75>
  801e3a:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  801e40:	85 db                	test   %ebx,%ebx
  801e42:	74 eb                	je     801e2f <ipc_recv+0x64>
  801e44:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  801e4a:	eb e3                	jmp    801e2f <ipc_recv+0x64>

00801e4c <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  801e4c:	f3 0f 1e fb          	endbr32 
  801e50:	55                   	push   %ebp
  801e51:	89 e5                	mov    %esp,%ebp
  801e53:	57                   	push   %edi
  801e54:	56                   	push   %esi
  801e55:	53                   	push   %ebx
  801e56:	83 ec 0c             	sub    $0xc,%esp
  801e59:	8b 7d 08             	mov    0x8(%ebp),%edi
  801e5c:	8b 75 0c             	mov    0xc(%ebp),%esi
  801e5f:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  801e62:	85 db                	test   %ebx,%ebx
  801e64:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  801e69:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  801e6c:	ff 75 14             	pushl  0x14(%ebp)
  801e6f:	53                   	push   %ebx
  801e70:	56                   	push   %esi
  801e71:	57                   	push   %edi
  801e72:	e8 14 f2 ff ff       	call   80108b <sys_ipc_try_send>
  801e77:	83 c4 10             	add    $0x10,%esp
  801e7a:	85 c0                	test   %eax,%eax
  801e7c:	79 1e                	jns    801e9c <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  801e7e:	83 f8 f9             	cmp    $0xfffffff9,%eax
  801e81:	75 07                	jne    801e8a <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  801e83:	e8 3b f0 ff ff       	call   800ec3 <sys_yield>
  801e88:	eb e2                	jmp    801e6c <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  801e8a:	50                   	push   %eax
  801e8b:	68 5a 26 80 00       	push   $0x80265a
  801e90:	6a 3b                	push   $0x3b
  801e92:	68 6e 26 80 00       	push   $0x80266e
  801e97:	e8 54 e4 ff ff       	call   8002f0 <_panic>
	}
}
  801e9c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801e9f:	5b                   	pop    %ebx
  801ea0:	5e                   	pop    %esi
  801ea1:	5f                   	pop    %edi
  801ea2:	5d                   	pop    %ebp
  801ea3:	c3                   	ret    

00801ea4 <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  801ea4:	f3 0f 1e fb          	endbr32 
  801ea8:	55                   	push   %ebp
  801ea9:	89 e5                	mov    %esp,%ebp
  801eab:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  801eae:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  801eb3:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801eb6:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801ebc:	8b 52 50             	mov    0x50(%edx),%edx
  801ebf:	39 ca                	cmp    %ecx,%edx
  801ec1:	74 11                	je     801ed4 <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  801ec3:	83 c0 01             	add    $0x1,%eax
  801ec6:	3d 00 04 00 00       	cmp    $0x400,%eax
  801ecb:	75 e6                	jne    801eb3 <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  801ecd:	b8 00 00 00 00       	mov    $0x0,%eax
  801ed2:	eb 0b                	jmp    801edf <ipc_find_env+0x3b>
			return envs[i].env_id;
  801ed4:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801ed7:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801edc:	8b 40 48             	mov    0x48(%eax),%eax
}
  801edf:	5d                   	pop    %ebp
  801ee0:	c3                   	ret    

00801ee1 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  801ee1:	f3 0f 1e fb          	endbr32 
  801ee5:	55                   	push   %ebp
  801ee6:	89 e5                	mov    %esp,%ebp
  801ee8:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  801eeb:	89 c2                	mov    %eax,%edx
  801eed:	c1 ea 16             	shr    $0x16,%edx
  801ef0:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  801ef7:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  801efc:	f6 c1 01             	test   $0x1,%cl
  801eff:	74 1c                	je     801f1d <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  801f01:	c1 e8 0c             	shr    $0xc,%eax
  801f04:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  801f0b:	a8 01                	test   $0x1,%al
  801f0d:	74 0e                	je     801f1d <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  801f0f:	c1 e8 0c             	shr    $0xc,%eax
  801f12:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  801f19:	ef 
  801f1a:	0f b7 d2             	movzwl %dx,%edx
}
  801f1d:	89 d0                	mov    %edx,%eax
  801f1f:	5d                   	pop    %ebp
  801f20:	c3                   	ret    
  801f21:	66 90                	xchg   %ax,%ax
  801f23:	66 90                	xchg   %ax,%ax
  801f25:	66 90                	xchg   %ax,%ax
  801f27:	66 90                	xchg   %ax,%ax
  801f29:	66 90                	xchg   %ax,%ax
  801f2b:	66 90                	xchg   %ax,%ax
  801f2d:	66 90                	xchg   %ax,%ax
  801f2f:	90                   	nop

00801f30 <__udivdi3>:
  801f30:	f3 0f 1e fb          	endbr32 
  801f34:	55                   	push   %ebp
  801f35:	57                   	push   %edi
  801f36:	56                   	push   %esi
  801f37:	53                   	push   %ebx
  801f38:	83 ec 1c             	sub    $0x1c,%esp
  801f3b:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  801f3f:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  801f43:	8b 74 24 34          	mov    0x34(%esp),%esi
  801f47:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  801f4b:	85 d2                	test   %edx,%edx
  801f4d:	75 19                	jne    801f68 <__udivdi3+0x38>
  801f4f:	39 f3                	cmp    %esi,%ebx
  801f51:	76 4d                	jbe    801fa0 <__udivdi3+0x70>
  801f53:	31 ff                	xor    %edi,%edi
  801f55:	89 e8                	mov    %ebp,%eax
  801f57:	89 f2                	mov    %esi,%edx
  801f59:	f7 f3                	div    %ebx
  801f5b:	89 fa                	mov    %edi,%edx
  801f5d:	83 c4 1c             	add    $0x1c,%esp
  801f60:	5b                   	pop    %ebx
  801f61:	5e                   	pop    %esi
  801f62:	5f                   	pop    %edi
  801f63:	5d                   	pop    %ebp
  801f64:	c3                   	ret    
  801f65:	8d 76 00             	lea    0x0(%esi),%esi
  801f68:	39 f2                	cmp    %esi,%edx
  801f6a:	76 14                	jbe    801f80 <__udivdi3+0x50>
  801f6c:	31 ff                	xor    %edi,%edi
  801f6e:	31 c0                	xor    %eax,%eax
  801f70:	89 fa                	mov    %edi,%edx
  801f72:	83 c4 1c             	add    $0x1c,%esp
  801f75:	5b                   	pop    %ebx
  801f76:	5e                   	pop    %esi
  801f77:	5f                   	pop    %edi
  801f78:	5d                   	pop    %ebp
  801f79:	c3                   	ret    
  801f7a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  801f80:	0f bd fa             	bsr    %edx,%edi
  801f83:	83 f7 1f             	xor    $0x1f,%edi
  801f86:	75 48                	jne    801fd0 <__udivdi3+0xa0>
  801f88:	39 f2                	cmp    %esi,%edx
  801f8a:	72 06                	jb     801f92 <__udivdi3+0x62>
  801f8c:	31 c0                	xor    %eax,%eax
  801f8e:	39 eb                	cmp    %ebp,%ebx
  801f90:	77 de                	ja     801f70 <__udivdi3+0x40>
  801f92:	b8 01 00 00 00       	mov    $0x1,%eax
  801f97:	eb d7                	jmp    801f70 <__udivdi3+0x40>
  801f99:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801fa0:	89 d9                	mov    %ebx,%ecx
  801fa2:	85 db                	test   %ebx,%ebx
  801fa4:	75 0b                	jne    801fb1 <__udivdi3+0x81>
  801fa6:	b8 01 00 00 00       	mov    $0x1,%eax
  801fab:	31 d2                	xor    %edx,%edx
  801fad:	f7 f3                	div    %ebx
  801faf:	89 c1                	mov    %eax,%ecx
  801fb1:	31 d2                	xor    %edx,%edx
  801fb3:	89 f0                	mov    %esi,%eax
  801fb5:	f7 f1                	div    %ecx
  801fb7:	89 c6                	mov    %eax,%esi
  801fb9:	89 e8                	mov    %ebp,%eax
  801fbb:	89 f7                	mov    %esi,%edi
  801fbd:	f7 f1                	div    %ecx
  801fbf:	89 fa                	mov    %edi,%edx
  801fc1:	83 c4 1c             	add    $0x1c,%esp
  801fc4:	5b                   	pop    %ebx
  801fc5:	5e                   	pop    %esi
  801fc6:	5f                   	pop    %edi
  801fc7:	5d                   	pop    %ebp
  801fc8:	c3                   	ret    
  801fc9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801fd0:	89 f9                	mov    %edi,%ecx
  801fd2:	b8 20 00 00 00       	mov    $0x20,%eax
  801fd7:	29 f8                	sub    %edi,%eax
  801fd9:	d3 e2                	shl    %cl,%edx
  801fdb:	89 54 24 08          	mov    %edx,0x8(%esp)
  801fdf:	89 c1                	mov    %eax,%ecx
  801fe1:	89 da                	mov    %ebx,%edx
  801fe3:	d3 ea                	shr    %cl,%edx
  801fe5:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  801fe9:	09 d1                	or     %edx,%ecx
  801feb:	89 f2                	mov    %esi,%edx
  801fed:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  801ff1:	89 f9                	mov    %edi,%ecx
  801ff3:	d3 e3                	shl    %cl,%ebx
  801ff5:	89 c1                	mov    %eax,%ecx
  801ff7:	d3 ea                	shr    %cl,%edx
  801ff9:	89 f9                	mov    %edi,%ecx
  801ffb:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  801fff:	89 eb                	mov    %ebp,%ebx
  802001:	d3 e6                	shl    %cl,%esi
  802003:	89 c1                	mov    %eax,%ecx
  802005:	d3 eb                	shr    %cl,%ebx
  802007:	09 de                	or     %ebx,%esi
  802009:	89 f0                	mov    %esi,%eax
  80200b:	f7 74 24 08          	divl   0x8(%esp)
  80200f:	89 d6                	mov    %edx,%esi
  802011:	89 c3                	mov    %eax,%ebx
  802013:	f7 64 24 0c          	mull   0xc(%esp)
  802017:	39 d6                	cmp    %edx,%esi
  802019:	72 15                	jb     802030 <__udivdi3+0x100>
  80201b:	89 f9                	mov    %edi,%ecx
  80201d:	d3 e5                	shl    %cl,%ebp
  80201f:	39 c5                	cmp    %eax,%ebp
  802021:	73 04                	jae    802027 <__udivdi3+0xf7>
  802023:	39 d6                	cmp    %edx,%esi
  802025:	74 09                	je     802030 <__udivdi3+0x100>
  802027:	89 d8                	mov    %ebx,%eax
  802029:	31 ff                	xor    %edi,%edi
  80202b:	e9 40 ff ff ff       	jmp    801f70 <__udivdi3+0x40>
  802030:	8d 43 ff             	lea    -0x1(%ebx),%eax
  802033:	31 ff                	xor    %edi,%edi
  802035:	e9 36 ff ff ff       	jmp    801f70 <__udivdi3+0x40>
  80203a:	66 90                	xchg   %ax,%ax
  80203c:	66 90                	xchg   %ax,%ax
  80203e:	66 90                	xchg   %ax,%ax

00802040 <__umoddi3>:
  802040:	f3 0f 1e fb          	endbr32 
  802044:	55                   	push   %ebp
  802045:	57                   	push   %edi
  802046:	56                   	push   %esi
  802047:	53                   	push   %ebx
  802048:	83 ec 1c             	sub    $0x1c,%esp
  80204b:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  80204f:	8b 74 24 30          	mov    0x30(%esp),%esi
  802053:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  802057:	8b 7c 24 38          	mov    0x38(%esp),%edi
  80205b:	85 c0                	test   %eax,%eax
  80205d:	75 19                	jne    802078 <__umoddi3+0x38>
  80205f:	39 df                	cmp    %ebx,%edi
  802061:	76 5d                	jbe    8020c0 <__umoddi3+0x80>
  802063:	89 f0                	mov    %esi,%eax
  802065:	89 da                	mov    %ebx,%edx
  802067:	f7 f7                	div    %edi
  802069:	89 d0                	mov    %edx,%eax
  80206b:	31 d2                	xor    %edx,%edx
  80206d:	83 c4 1c             	add    $0x1c,%esp
  802070:	5b                   	pop    %ebx
  802071:	5e                   	pop    %esi
  802072:	5f                   	pop    %edi
  802073:	5d                   	pop    %ebp
  802074:	c3                   	ret    
  802075:	8d 76 00             	lea    0x0(%esi),%esi
  802078:	89 f2                	mov    %esi,%edx
  80207a:	39 d8                	cmp    %ebx,%eax
  80207c:	76 12                	jbe    802090 <__umoddi3+0x50>
  80207e:	89 f0                	mov    %esi,%eax
  802080:	89 da                	mov    %ebx,%edx
  802082:	83 c4 1c             	add    $0x1c,%esp
  802085:	5b                   	pop    %ebx
  802086:	5e                   	pop    %esi
  802087:	5f                   	pop    %edi
  802088:	5d                   	pop    %ebp
  802089:	c3                   	ret    
  80208a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802090:	0f bd e8             	bsr    %eax,%ebp
  802093:	83 f5 1f             	xor    $0x1f,%ebp
  802096:	75 50                	jne    8020e8 <__umoddi3+0xa8>
  802098:	39 d8                	cmp    %ebx,%eax
  80209a:	0f 82 e0 00 00 00    	jb     802180 <__umoddi3+0x140>
  8020a0:	89 d9                	mov    %ebx,%ecx
  8020a2:	39 f7                	cmp    %esi,%edi
  8020a4:	0f 86 d6 00 00 00    	jbe    802180 <__umoddi3+0x140>
  8020aa:	89 d0                	mov    %edx,%eax
  8020ac:	89 ca                	mov    %ecx,%edx
  8020ae:	83 c4 1c             	add    $0x1c,%esp
  8020b1:	5b                   	pop    %ebx
  8020b2:	5e                   	pop    %esi
  8020b3:	5f                   	pop    %edi
  8020b4:	5d                   	pop    %ebp
  8020b5:	c3                   	ret    
  8020b6:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8020bd:	8d 76 00             	lea    0x0(%esi),%esi
  8020c0:	89 fd                	mov    %edi,%ebp
  8020c2:	85 ff                	test   %edi,%edi
  8020c4:	75 0b                	jne    8020d1 <__umoddi3+0x91>
  8020c6:	b8 01 00 00 00       	mov    $0x1,%eax
  8020cb:	31 d2                	xor    %edx,%edx
  8020cd:	f7 f7                	div    %edi
  8020cf:	89 c5                	mov    %eax,%ebp
  8020d1:	89 d8                	mov    %ebx,%eax
  8020d3:	31 d2                	xor    %edx,%edx
  8020d5:	f7 f5                	div    %ebp
  8020d7:	89 f0                	mov    %esi,%eax
  8020d9:	f7 f5                	div    %ebp
  8020db:	89 d0                	mov    %edx,%eax
  8020dd:	31 d2                	xor    %edx,%edx
  8020df:	eb 8c                	jmp    80206d <__umoddi3+0x2d>
  8020e1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8020e8:	89 e9                	mov    %ebp,%ecx
  8020ea:	ba 20 00 00 00       	mov    $0x20,%edx
  8020ef:	29 ea                	sub    %ebp,%edx
  8020f1:	d3 e0                	shl    %cl,%eax
  8020f3:	89 44 24 08          	mov    %eax,0x8(%esp)
  8020f7:	89 d1                	mov    %edx,%ecx
  8020f9:	89 f8                	mov    %edi,%eax
  8020fb:	d3 e8                	shr    %cl,%eax
  8020fd:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802101:	89 54 24 04          	mov    %edx,0x4(%esp)
  802105:	8b 54 24 04          	mov    0x4(%esp),%edx
  802109:	09 c1                	or     %eax,%ecx
  80210b:	89 d8                	mov    %ebx,%eax
  80210d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802111:	89 e9                	mov    %ebp,%ecx
  802113:	d3 e7                	shl    %cl,%edi
  802115:	89 d1                	mov    %edx,%ecx
  802117:	d3 e8                	shr    %cl,%eax
  802119:	89 e9                	mov    %ebp,%ecx
  80211b:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  80211f:	d3 e3                	shl    %cl,%ebx
  802121:	89 c7                	mov    %eax,%edi
  802123:	89 d1                	mov    %edx,%ecx
  802125:	89 f0                	mov    %esi,%eax
  802127:	d3 e8                	shr    %cl,%eax
  802129:	89 e9                	mov    %ebp,%ecx
  80212b:	89 fa                	mov    %edi,%edx
  80212d:	d3 e6                	shl    %cl,%esi
  80212f:	09 d8                	or     %ebx,%eax
  802131:	f7 74 24 08          	divl   0x8(%esp)
  802135:	89 d1                	mov    %edx,%ecx
  802137:	89 f3                	mov    %esi,%ebx
  802139:	f7 64 24 0c          	mull   0xc(%esp)
  80213d:	89 c6                	mov    %eax,%esi
  80213f:	89 d7                	mov    %edx,%edi
  802141:	39 d1                	cmp    %edx,%ecx
  802143:	72 06                	jb     80214b <__umoddi3+0x10b>
  802145:	75 10                	jne    802157 <__umoddi3+0x117>
  802147:	39 c3                	cmp    %eax,%ebx
  802149:	73 0c                	jae    802157 <__umoddi3+0x117>
  80214b:	2b 44 24 0c          	sub    0xc(%esp),%eax
  80214f:	1b 54 24 08          	sbb    0x8(%esp),%edx
  802153:	89 d7                	mov    %edx,%edi
  802155:	89 c6                	mov    %eax,%esi
  802157:	89 ca                	mov    %ecx,%edx
  802159:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  80215e:	29 f3                	sub    %esi,%ebx
  802160:	19 fa                	sbb    %edi,%edx
  802162:	89 d0                	mov    %edx,%eax
  802164:	d3 e0                	shl    %cl,%eax
  802166:	89 e9                	mov    %ebp,%ecx
  802168:	d3 eb                	shr    %cl,%ebx
  80216a:	d3 ea                	shr    %cl,%edx
  80216c:	09 d8                	or     %ebx,%eax
  80216e:	83 c4 1c             	add    $0x1c,%esp
  802171:	5b                   	pop    %ebx
  802172:	5e                   	pop    %esi
  802173:	5f                   	pop    %edi
  802174:	5d                   	pop    %ebp
  802175:	c3                   	ret    
  802176:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80217d:	8d 76 00             	lea    0x0(%esi),%esi
  802180:	29 fe                	sub    %edi,%esi
  802182:	19 c3                	sbb    %eax,%ebx
  802184:	89 f2                	mov    %esi,%edx
  802186:	89 d9                	mov    %ebx,%ecx
  802188:	e9 1d ff ff ff       	jmp    8020aa <__umoddi3+0x6a>
